My mod only works in IDE, when I run the game with the launcher it crashes

[17:58:17] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher running: args [–username, Silerw, --version, 1.18.2-forge-40.2.0, --gameDir, C:\Users\John\AppData\Roaming.minecraft, --assetsDir, C:\Users\John\AppData\Roaming.minecraft\assets, --assetIndex, 1.18, --uuid, 9f875b541c663d55ab2b4fe584814a10, --accessToken, ???, --clientId, ${clientid}, --xuid, ${auth_xuid}, --userType, mojang, --versionType, release, --launchTarget, forgeclient, --fml.forgeVersion, 40.2.0, --fml.mcVersion, 1.18.2, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20220404.173914]
[17:58:17] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher 9.1.3+9.1.3+main.9b69c82a starting: java version 17.0.1 by Microsoft
[17:58:18] [main/INFO] [mixin/]: SpongePowered MIXIN Subsystem Version=0.8.5 Source=union:/C:/Users/John/AppData/Roaming/.minecraft/libraries/org/spongepowered/mixin/0.8.5/mixin-0.8.5.jar%2314!/ Service=ModLauncher Env=CLIENT
[17:58:18] [main/WARN] [ne.mi.fm.lo.mo.ModFileParser/LOADING]: Mod file C:\Users\John\AppData\Roaming.minecraft\libraries\net\minecraftforge\fmlcore\1.18.2-40.2.0\fmlcore-1.18.2-40.2.0.jar is missing mods.toml file
[17:58:18] [main/WARN] [ne.mi.fm.lo.mo.ModFileParser/LOADING]: Mod file C:\Users\John\AppData\Roaming.minecraft\libraries\net\minecraftforge\javafmllanguage\1.18.2-40.2.0\javafmllanguage-1.18.2-40.2.0.jar is missing mods.toml file
[17:58:18] [main/WARN] [ne.mi.fm.lo.mo.ModFileParser/LOADING]: Mod file C:\Users\John\AppData\Roaming.minecraft\libraries\net\minecraftforge\lowcodelanguage\1.18.2-40.2.0\lowcodelanguage-1.18.2-40.2.0.jar is missing mods.toml file
[17:58:18] [main/WARN] [ne.mi.fm.lo.mo.ModFileParser/LOADING]: Mod file C:\Users\John\AppData\Roaming.minecraft\libraries\net\minecraftforge\mclanguage\1.18.2-40.2.0\mclanguage-1.18.2-40.2.0.jar is missing mods.toml file
[17:58:18] [main/INFO] [ne.mi.fm.lo.mo.JarInJarDependencyLocator/]: No dependencies to load found. Skipping!
[17:58:19] [main/INFO] [mixin/]: Compatibility level set to JAVA_17
[17:58:19] [main/INFO] [cp.mo.mo.LaunchServiceHandler/MODLAUNCHER]: Launching target ‘forgeclient’ with arguments [–version, 1.18.2-forge-40.2.0, --gameDir, C:\Users\John\AppData\Roaming.minecraft, --assetsDir, C:\Users\John\AppData\Roaming.minecraft\assets, --uuid, 9f875b541c663d55ab2b4fe584814a10, --username, Silerw, --assetIndex, 1.18, --accessToken, ???, --clientId, ${clientid}, --xuid, ${auth_xuid}, --userType, mojang, --versionType, release]
[17:58:19] [main/WARN] [mixin/]: Reference map ‘testmod.refmap.json’ for META-INF/testmod.mixins.json could not be read. If this is a development environment you can ignore this message
[17:58:20] [pool-5-thread-1/FATAL] [mixin/]: Mixin apply failed META-INF/testmod.mixins.json:accessor.PlayerAccessor → net.minecraft.world.entity.player.Player: org.spongepowered.asm.mixin.gen.throwables.InvalidAccessorException No candidates were found matching lastItemInMainHand:Lnet/minecraft/world/item/ItemStack; in net/minecraft/world/entity/player/Player for META-INF/testmod.mixins.json:accessor.PlayerAccessor->@Accessor[FIELD_GETTER]::getLastItemInMainHand()Lnet/minecraft/world/item/ItemStack; [INJECT Applicator Phase → META-INF/testmod.mixins.json:accessor.PlayerAccessor → Apply Accessors → → Locate → META-INF/testmod.mixins.json:accessor.PlayerAccessor->@Accessor[FIELD_GETTER]::getLastItemInMainHand()Lnet/minecraft/world/item/ItemStack;]
org.spongepowered.asm.mixin.gen.throwables.InvalidAccessorException: No candidates were found matching lastItemInMainHand:Lnet/minecraft/world/item/ItemStack; in net/minecraft/world/entity/player/Player for META-INF/testmod.mixins.json:accessor.PlayerAccessor->@Accessor[FIELD_GETTER]::getLastItemInMainHand()Lnet/minecraft/world/item/ItemStack; [INJECT Applicator Phase → META-INF/testmod.mixins.json:accessor.PlayerAccessor → Apply Accessors → → Locate → META-INF/testmod.mixins.json:accessor.PlayerAccessor->@Accessor[FIELD_GETTER]::getLastItemInMainHand()Lnet/minecraft/world/item/ItemStack;]
at org.spongepowered.asm.mixin.gen.AccessorInfo.findTarget(AccessorInfo.java:518) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4] {}
at org.spongepowered.asm.mixin.gen.AccessorInfo.findTargetField(AccessorInfo.java:501) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4] {}
at org.spongepowered.asm.mixin.gen.AccessorInfo.locate(AccessorInfo.java:475) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4] {}
at org.spongepowered.asm.mixin.transformer.MixinTargetContext.generateAccessors(MixinTargetContext.java:1389) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4] {}
at org.spongepowered.asm.mixin.transformer.MixinApplicatorStandard.applyAccessors(MixinApplicatorStandard.java:1060) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4] {}
at org.spongepowered.asm.mixin.transformer.MixinApplicatorStandard.applyMixin(MixinApplicatorStandard.java:398) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4] {}
at org.spongepowered.asm.mixin.transformer.MixinApplicatorStandard.apply(MixinApplicatorStandard.java:325) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4] {}
at org.spongepowered.asm.mixin.transformer.TargetClassContext.apply(TargetClassContext.java:383) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4] {}
at org.spongepowered.asm.mixin.transformer.TargetClassContext.applyMixins(TargetClassContext.java:365) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4] {}
at org.spongepowered.asm.mixin.transformer.MixinProcessor.applyMixins(MixinProcessor.java:363) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4] {}
at org.spongepowered.asm.mixin.transformer.MixinTransformer.transformClass(MixinTransformer.java:250) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4] {}
at org.spongepowered.asm.service.modlauncher.MixinTransformationHandler.processClass(MixinTransformationHandler.java:131) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4] {}
at org.spongepowered.asm.launch.MixinLaunchPluginLegacy.processClass(MixinLaunchPluginLegacy.java:131) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4] {}
at cpw.mods.modlauncher.serviceapi.ILaunchPluginService.processClassWithFlags(ILaunchPluginService.java:156) ~[modlauncher-9.1.3.jar:9.1.3+9.1.3+main.9b69c82a] {}
at cpw.mods.modlauncher.LaunchPluginHandler.offerClassNodeToPlugins(LaunchPluginHandler.java:88) ~[modlauncher-9.1.3.jar:?] {}
at cpw.mods.modlauncher.ClassTransformer.transform(ClassTransformer.java:120) ~[modlauncher-9.1.3.jar:?] {}
at cpw.mods.modlauncher.TransformingClassLoader.maybeTransformClassBytes(TransformingClassLoader.java:50) ~[modlauncher-9.1.3.jar:?] {}
at cpw.mods.cl.ModuleClassLoader.readerToClass(ModuleClassLoader.java:110) ~[securejarhandler-1.0.3.jar:?] {}
at cpw.mods.cl.ModuleClassLoader.lambda$findClass$16(ModuleClassLoader.java:216) ~[securejarhandler-1.0.3.jar:?] {}
at cpw.mods.cl.ModuleClassLoader.loadFromModule(ModuleClassLoader.java:226) ~[securejarhandler-1.0.3.jar:?] {}
at cpw.mods.cl.ModuleClassLoader.findClass(ModuleClassLoader.java:216) ~[securejarhandler-1.0.3.jar:?] {}
at cpw.mods.cl.ModuleClassLoader.loadClass(ModuleClassLoader.java:132) ~[securejarhandler-1.0.3.jar:?] {}
at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?] {}
at net.minecraftforge.registries.GameData.init(GameData.java:123) ~[forge-1.18.2-40.2.0-universal.jar%2359!/:?] {re:classloading}
at net.minecraftforge.registries.GameData.(GameData.java:108) ~[forge-1.18.2-40.2.0-universal.jar%2359!/:?] {re:classloading}
at net.minecraft.core.Registry.forge(Registry.java:407) ~[client-1.18.2-20220404.173914-srg.jar%2354!/:?] {re:classloading}
at net.minecraft.core.Registry.forge(Registry.java:391) ~[client-1.18.2-20220404.173914-srg.jar%2354!/:?] {re:classloading}
at net.minecraft.core.Registry.(Registry.java:170) ~[client-1.18.2-20220404.173914-srg.jar%2354!/:?] {re:classloading}
at net.minecraft.server.Bootstrap.m_135870_(Bootstrap.java:44) ~[client-1.18.2-20220404.173914-srg.jar%2354!/:?] {re:classloading}
at net.minecraft.client.main.Main.lambda$main$0(Main.java:138) ~[client-1.18.2-20220404.173914-srg.jar%2354!/:?] {re:classloading,pl:runtimedistcleaner:A}
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) [?:?] {}
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?] {}
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?] {}
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?] {}
at java.lang.Thread.run(Thread.java:833) [?:?] {}
Exception in thread “main” java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:39)
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53)
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71)
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.run(Launcher.java:106)
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.main(Launcher.java:77)
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26)
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23)
at [email protected]/cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:149)
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at MC-BOOTSTRAP/[email protected]/net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler.lambda$launchService$0(CommonClientLaunchHandler.java:31)
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37)
… 7 more
Caused by: java.lang.RuntimeException: org.spongepowered.asm.mixin.transformer.throwables.MixinTransformerError: An unexpected critical error was encountered
at MC-BOOTSTRAP/[email protected]/net.minecraftforge.fml.loading.BackgroundWaiter.runAndTick(BackgroundWaiter.java:29)
at TRANSFORMER/[email protected]/net.minecraft.client.main.Main.main(Main.java:138)
… 13 more
Caused by: org.spongepowered.asm.mixin.transformer.throwables.MixinTransformerError: An unexpected critical error was encountered
at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinProcessor.applyMixins(MixinProcessor.java:392)
at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinTransformer.transformClass(MixinTransformer.java:250)
at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.service.modlauncher.MixinTransformationHandler.processClass(MixinTransformationHandler.java:131)
at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.launch.MixinLaunchPluginLegacy.processClass(MixinLaunchPluginLegacy.java:131)
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.serviceapi.ILaunchPluginService.processClassWithFlags(ILaunchPluginService.java:156)
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchPluginHandler.offerClassNodeToPlugins(LaunchPluginHandler.java:88)
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.ClassTransformer.transform(ClassTransformer.java:120)
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.TransformingClassLoader.maybeTransformClassBytes(TransformingClassLoader.java:50)
at [email protected]/cpw.mods.cl.ModuleClassLoader.readerToClass(ModuleClassLoader.java:110)
at [email protected]/cpw.mods.cl.ModuleClassLoader.lambda$findClass$16(ModuleClassLoader.java:216)
at [email protected]/cpw.mods.cl.ModuleClassLoader.loadFromModule(ModuleClassLoader.java:226)
at [email protected]/cpw.mods.cl.ModuleClassLoader.findClass(ModuleClassLoader.java:216)
at [email protected]/cpw.mods.cl.ModuleClassLoader.loadClass(ModuleClassLoader.java:132)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
at TRANSFORMER/[email protected]/net.minecraftforge.registries.GameData.init(GameData.java:123)
at TRANSFORMER/[email protected]/net.minecraftforge.registries.GameData.(GameData.java:108)
at TRANSFORMER/[email protected]/net.minecraft.core.Registry.forge(Registry.java:407)
at TRANSFORMER/[email protected]/net.minecraft.core.Registry.forge(Registry.java:391)
at TRANSFORMER/[email protected]/net.minecraft.core.Registry.(Registry.java:170)
at TRANSFORMER/[email protected]/net.minecraft.server.Bootstrap.m_135870_(Bootstrap.java:44)
at TRANSFORMER/[email protected]/net.minecraft.client.main.Main.lambda$main$0(Main.java:138)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.spongepowered.asm.mixin.throwables.MixinApplyError: Mixin [META-INF/testmod.mixins.json:accessor.PlayerAccessor] from phase [DEFAULT] in config [META-INF/testmod.mixins.json] FAILED during APPLY
at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinProcessor.handleMixinError(MixinProcessor.java:636)
at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinProcessor.handleMixinApplyError(MixinProcessor.java:588)
at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinProcessor.applyMixins(MixinProcessor.java:379)
… 25 more
Caused by: org.spongepowered.asm.mixin.gen.throwables.InvalidAccessorException: No candidates were found matching lastItemInMainHand:Lnet/minecraft/world/item/ItemStack; in net/minecraft/world/entity/player/Player for META-INF/testmod.mixins.json:accessor.PlayerAccessor->@Accessor[FIELD_GETTER]::getLastItemInMainHand()Lnet/minecraft/world/item/ItemStack; [INJECT Applicator Phase → META-INF/testmod.mixins.json:accessor.PlayerAccessor → Apply Accessors → → Locate → META-INF/testmod.mixins.json:accessor.PlayerAccessor->@Accessor[FIELD_GETTER]::getLastItemInMainHand()Lnet/minecraft/world/item/ItemStack;]
at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.gen.AccessorInfo.findTarget(AccessorInfo.java:518)
at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.gen.AccessorInfo.findTargetField(AccessorInfo.java:501)
at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.gen.AccessorInfo.locate(AccessorInfo.java:475)
at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinTargetContext.generateAccessors(MixinTargetContext.java:1389)
at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinApplicatorStandard.applyAccessors(MixinApplicatorStandard.java:1060)
at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinApplicatorStandard.applyMixin(MixinApplicatorStandard.java:398)
at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinApplicatorStandard.apply(MixinApplicatorStandard.java:325)
at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.TargetClassContext.apply(TargetClassContext.java:383)
at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.TargetClassContext.applyMixins(TargetClassContext.java:365)
at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinProcessor.applyMixins(MixinProcessor.java:363)
… 25 more