我尝试为pixelmon制作一个sidemod,所以我将pixelmon.jar文件放在libs文件夹中,单击“添加为库...”按钮并在build.gradle文件中实现它:
dependencies{
minecraft 'net.minecraftforge:forge:1.16.5-36.2.34'
implementation files('libs/Pixelmon-1.16.5-9.1.7-universal.jar')
}
但是当我运行它时,它说:
java.lang.NoSuchMethodError: net.minecraft.world.server.TicketType.func_223183_a(Ljava/lang/String;Ljava/util/Comparator;I)Lnet/minecraft/world/server/TicketType;
这是最新的日志:
[11Oct2023 17:46:26.845] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher 8.1.3+8.1.3+main-8.1.x.c94d18ec starting: java version 1.8.0_382 by Temurin
[11Oct2023 17:46:29.042] [main/INFO] [net.minecraftforge.fml.loading.FixSSL/CORE]: Added Lets Encrypt root certificates as additional trust
[11Oct2023 17:46:29.154] [main/INFO] [mixin/]: SpongePowered MIXIN Subsystem Version=0.8.4 Source=file:/C:/Users/user/.gradle/caches/modules-2/files-2.1/org.spongepowered/mixin/0.8.4/4ec7d77d9ab32596ca0b78bb123956734767e3a/mixin-0.8.4.jar Service=ModLauncher Env=CLIENT
[11Oct2023 17:46:32.923] [main/INFO] [cpw.mods.modlauncher.LaunchServiceHandler/MODLAUNCHER]: Launching target 'fmluserdevclient' with arguments [--version, MOD_DEV, --gameDir, ., --assetsDir, C:\Users\user\.gradle\caches\forge_gradle\assets, --assetIndex, 1.16, --username, Dev, --accessToken, ????????, --userProperties, {}]
[11Oct2023 17:46:52.060] [Render thread/INFO] [com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService/]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD'
[11Oct2023 17:46:53.365] [Render thread/INFO] [net.minecraft.client.Minecraft/]: Setting user: Dev
[11Oct2023 17:46:53.732] [Render thread/INFO] [net.minecraft.client.Minecraft/]: Backend library: LWJGL version 3.2.2 build 10
[11Oct2023 17:46:56.406] [modloading-worker-2/INFO] [net.minecraftforge.common.ForgeMod/FORGEMOD]: Forge mod loading, version 36.2.34, for MC 1.16.5 with MCP 20210115.111550
[11Oct2023 17:46:56.556] [modloading-worker-2/INFO] [net.minecraftforge.common.MinecraftForge/FORGE]: MinecraftForge v36.2.34 Initialized
[11Oct2023 17:46:56.715] [modloading-worker-0/INFO] [Pixelmon/]: Patched lifecycle fields.
[11Oct2023 17:46:57.423] [modloading-worker-0/ERROR] [net.minecraftforge.fml.javafmlmod.FMLModContainer/LOADING]: Failed to create mod instance. ModID: pixelmon, class com.pixelmonmod.pixelmon.Pixelmon
java.lang.NoSuchMethodError: net.minecraft.world.server.TicketType.func_223183_a(Ljava/lang/String;Ljava/util/Comparator;I)Lnet/minecraft/world/server/TicketType;
at com.pixelmonmod.pixelmon.api.registries.PixelmonTicketType.<clinit>(PixelmonTicketType.java:7) ~[pixelmon:1.16.5-9.1.7]
at com.pixelmonmod.pixelmon.Pixelmon.<init>(Pixelmon.java:124) ~[pixelmon:1.16.5-9.1.7]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_382]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_382]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_382]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_382]
at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_382]
at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:81) ~[forge:36.2]
at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:120) ~[forge:?]
at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1640) [?:1.8.0_382]
at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1632) [?:1.8.0_382]
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) [?:1.8.0_382]
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) [?:1.8.0_382]
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) [?:1.8.0_382]
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175) [?:1.8.0_382]
[11Oct2023 17:46:57.448] [modloading-worker-1/ERROR] [net.minecraftforge.fml.javafmlmod.FMLModContainer/LOADING]: Failed to create mod instance. ModID: tcg, class com.pixelmonmod.tcg.TCG
java.lang.NoSuchMethodError: net.minecraft.item.Item$Properties.func_200917_a(I)Lnet/minecraft/item/Item$Properties;
at com.pixelmonmod.tcg.init.registry.BlockRegistration.<clinit>(BlockRegistration.java:91) ~[pixelmon:1.16.5-9.1.7]
at com.pixelmonmod.tcg.TCG.<init>(TCG.java:51) ~[pixelmon:1.16.5-9.1.7]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_382]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_382]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_382]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_382]
at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_382]
at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:81) ~[forge:36.2]
at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:120) ~[forge:?]
at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1640) [?:1.8.0_382]
at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1632) [?:1.8.0_382]
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) [?:1.8.0_382]
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) [?:1.8.0_382]
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) [?:1.8.0_382]
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175) [?:1.8.0_382]
[11Oct2023 17:46:58.057] [Render thread/FATAL] [net.minecraftforge.fml.ModLoader/LOADING]: Failed to complete lifecycle event CONSTRUCT, 2 errors found
[11Oct2023 17:46:58.409] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.sound.SoundLoadEvent to a broken mod state
[11Oct2023 17:46:58.732] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.ColorHandlerEvent$Block to a broken mod state
[11Oct2023 17:46:58.735] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.ColorHandlerEvent$Item to a broken mod state
[11Oct2023 17:47:00.589] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.ParticleFactoryRegisterEvent to a broken mod state
[11Oct2023 17:47:00.672] [Render thread/INFO] [com.mojang.text2speech.NarratorWindows/]: Narrator library for x64 successfully loaded
[11Oct2023 17:47:00.836] [Render thread/INFO] [net.minecraft.resources.SimpleReloadableResourceManager/]: Reloading ResourceManager: Default
[11Oct2023 17:47:01.741] [Worker-Main-6/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.ModelRegistryEvent to a broken mod state
[11Oct2023 17:47:02.376] [Worker-Main-5/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state
[11Oct2023 17:47:05.342] [Worker-Main-4/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state
[11Oct2023 17:47:09.320] [Worker-Main-6/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state
[11Oct2023 17:47:09.540] [Worker-Main-7/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state
[11Oct2023 17:47:11.348] [Worker-Main-6/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state
[11Oct2023 17:47:11.358] [Worker-Main-6/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state
[11Oct2023 17:47:11.441] [Worker-Main-6/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state
[11Oct2023 17:47:11.477] [Worker-Main-6/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state
[11Oct2023 17:47:11.488] [Worker-Main-6/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state
[11Oct2023 17:47:11.506] [Worker-Main-6/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state
[11Oct2023 17:47:12.276] [Render thread/INFO] [net.minecraft.client.audio.SoundSystem/]: OpenAL initialized.
[11Oct2023 17:47:12.277] [Render thread/INFO] [net.minecraft.client.audio.SoundEngine/SOUNDS]: Sound engine started
[11Oct2023 17:47:12.582] [Render thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 1024x512x4 minecraft:textures/atlas/blocks.png-atlas
[11Oct2023 17:47:12.718] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state
[11Oct2023 17:47:12.719] [Render thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 256x128x4 minecraft:textures/atlas/signs.png-atlas
[11Oct2023 17:47:12.719] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state
[11Oct2023 17:47:12.719] [Render thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 512x512x4 minecraft:textures/atlas/banner_patterns.png-atlas
[11Oct2023 17:47:12.721] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state
[11Oct2023 17:47:12.721] [Render thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 512x512x4 minecraft:textures/atlas/shield_patterns.png-atlas
[11Oct2023 17:47:12.723] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state
[11Oct2023 17:47:12.723] [Render thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 256x256x4 minecraft:textures/atlas/chest.png-atlas
[11Oct2023 17:47:12.723] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state
[11Oct2023 17:47:12.723] [Render thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 512x256x4 minecraft:textures/atlas/beds.png-atlas
[11Oct2023 17:47:12.724] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state
[11Oct2023 17:47:12.724] [Render thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 512x256x4 minecraft:textures/atlas/shulker_boxes.png-atlas
[11Oct2023 17:47:12.725] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state
[11Oct2023 17:47:13.198] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.ModelBakeEvent to a broken mod state
[11Oct2023 17:47:13.534] [Render thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 256x256x0 minecraft:textures/atlas/particles.png-atlas
[11Oct2023 17:47:13.535] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state
[11Oct2023 17:47:13.536] [Render thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 256x256x0 minecraft:textures/atlas/paintings.png-atlas
[11Oct2023 17:47:13.537] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state
[11Oct2023 17:47:13.537] [Render thread/INFO] [net.minecraft.client.renderer.texture.AtlasTexture/]: Created: 128x128x0 minecraft:textures/atlas/mob_effects.png-atlas
[11Oct2023 17:47:13.538] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state
[11Oct2023 17:47:13.616] [Render thread/FATAL] [net.minecraftforge.common.ForgeMod/]: Preparing crash report with UUID f8ebac5e-0c0f-435d-8370-ced8c89ed633
[11Oct2023 17:47:13.617] [Render thread/INFO] [STDOUT/]: [net.minecraft.crash.CrashReport:addCategory:196]: Negative index in crash report handler (21/23)
[11Oct2023 17:47:13.673] [Render thread/FATAL] [net.minecraftforge.fml.client.ClientModLoader/]: Crash report saved to .\crash-reports\crash-2023-10-11_17.47.13-fml.txt
如果有人能帮助我正确加载我的 mod 并且我可以使用它的 API,我会很高兴。
嘿,我自己偶然发现了这个问题,正在寻找解决方案,最终我找到了一个可以处理您的 .gradle 和 .toml 的解决方案,确保它们是相似的
问题出在 build.gradle 中的 loader_version_range 和 forge_version_range 字段。您正在为加载程序和 Forge 设置精确的版本,但是您正在使用的 mods.toml 需要灵活的版本范围,以避免出现像您之前遇到的错误。
解决方案: 更新 processResources 任务中的 loader_version_range 和 forge_version_range 以使用更灵活的版本范围。 确保 build.gradle 文件中的 versionRange 与您在 mods.toml 中所做的版本更改保持一致。