Jump to content

Recommended Posts

Posted

Hello !

When I try to run a server with my mod, an error occurs and make the server crashes. It seems that the error happens on the client setup and more precisely when I try to register a new ItemProperties.

private void clientSetup(final FMLClientSetupEvent event) {
        MenuScreens.register(MenuManager.MOB_FARM_MENU.get(), MobFarmScreen::new);

        ItemBlockRenderTypes.setRenderLayer(BlockManager.IRON_MOB_FARM.get(), RenderType.cutout());
        ItemBlockRenderTypes.setRenderLayer(BlockManager.GOLD_MOB_FARM.get(), RenderType.cutout());
        ItemBlockRenderTypes.setRenderLayer(BlockManager.DIAMOND_MOB_FARM.get(), RenderType.cutout());
        ItemBlockRenderTypes.setRenderLayer(BlockManager.EMERALD_MOB_FARM.get(), RenderType.cutout());
        ItemBlockRenderTypes.setRenderLayer(BlockManager.NETHERITE_MOB_FARM.get(), RenderType.cutout());

        event.enqueueWork(() -> {
            ItemProperties.register(ItemManager.MOB_SHARD.get(), new ResourceLocation(PerfectMobFarm.MODID, "completed"), ((pStack, pLevel, pEntity, pSeed) -> {
                CompoundTag nbtData = pStack.getTag();
                if (nbtData != null && nbtData.contains(NbtTagsName.KILLED_COUNT)) {
                    return nbtData.getInt(NbtTagsName.KILLED_COUNT) == CommonConfigs.MOB_SHARD_KILL_NEEDED.get() ? 1.0F : 0.0F;
                }
                return 0.0F;
            }));

            ItemProperties.register(ItemManager.ADVANCED_MOB_SHARD.get(), new ResourceLocation(PerfectMobFarm.MODID, "completed"), ((pStack, pLevel, pEntity, pSeed) -> {
                CompoundTag nbtData = pStack.getTag();
                if (nbtData != null && nbtData.contains(NbtTagsName.KILLED_COUNT)) {
                    return nbtData.getInt(NbtTagsName.KILLED_COUNT) == CommonConfigs.MOB_SHARD_KILL_NEEDED.get() ? 1.0F : 0.0F;
                }
                return 0.0F;
            }));
        });
    }

When I comment the event.enqueueWork block, the server doesn't crash. Just below is the error stack trace.

Spoiler
-- Head --
Thread: main
Stacktrace:
	at net.minecraftforge.fml.loading.RuntimeDistCleaner.processClassWithFlags(RuntimeDistCleaner.java:57) ~[fmlloader-1.18.2-40.1.0.jar%230!/:1.0] {}
-- MOD perfectmobfarm --
Details:
	Caused by 0: java.lang.reflect.InvocationTargetException
		at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?] {}
		at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) ~[?:?] {}
		at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?] {}
		at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[?:?] {}
		at java.lang.reflect.Constructor.newInstance(Constructor.java:480) ~[?:?] {}
		at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:67) ~[javafmllanguage-1.18.2-40.1.0.jar%2377!/:?] {}
		at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:106) ~[fmlcore-1.18.2-40.1.0.jar%2379!/:?] {}
		at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) ~[?:?] {}
		at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796) ~[?:?] {}
		at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?] {}
		at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[?:?] {}
		at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?] {}
		at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?] {}
		at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?] {}

	Mod File: main
	Failure message: Perfect Mob Farm (perfectmobfarm) has failed to load correctly
		java.lang.reflect.InvocationTargetException: null
	Mod Version: 0.0NONE
	Mod Issue URL: NOT PROVIDED
	Exception message: java.lang.RuntimeException: Attempted to load class net/minecraft/client/multiplayer/ClientLevel for invalid dist DEDICATED_SERVER
Stacktrace:
	at net.minecraftforge.fml.loading.RuntimeDistCleaner.processClassWithFlags(RuntimeDistCleaner.java:57) ~[fmlloader-1.18.2-40.1.0.jar:1.0] {}
	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 java.lang.Class.getDeclaredMethods0(Native Method) ~[?:?] {}
	at java.lang.Class.privateGetDeclaredMethods(Class.java:3402) ~[?:?] {}
	at java.lang.Class.getDeclaredMethod(Class.java:2673) ~[?:?] {}
	at net.minecraftforge.eventbus.EventBus.getDeclMethod(EventBus.java:83) ~[eventbus-5.0.7.jar%239!/:?] {}
	at net.minecraftforge.eventbus.EventBus.lambda$registerObject$4(EventBus.java:95) ~[eventbus-5.0.7.jar%239!/:?] {}
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[?:?] {}
	at java.util.HashMap$KeySpliterator.tryAdvance(HashMap.java:1728) ~[?:?] {}
	at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:129) ~[?:?] {}
	at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:527) ~[?:?] {}
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513) ~[?:?] {}
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?] {}
	at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150) ~[?:?] {}
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?] {}
	at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:647) ~[?:?] {}
	at net.minecraftforge.eventbus.EventBus.lambda$registerObject$7(EventBus.java:97) ~[eventbus-5.0.7.jar%239!/:?] {}
	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) ~[?:?] {}
	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) ~[?:?] {}
	at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992) ~[?:?] {}
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?] {}
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?] {}
	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[?:?] {}
	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[?:?] {}
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?] {}
	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) ~[?:?] {}
	at net.minecraftforge.eventbus.EventBus.registerObject(EventBus.java:94) ~[eventbus-5.0.7.jar%239!/:?] {}
	at net.minecraftforge.eventbus.EventBus.register(EventBus.java:120) ~[eventbus-5.0.7.jar%239!/:?] {}
	at com.sweetmimike.perfectmobfarm.PerfectMobFarm.<init>(PerfectMobFarm.java:67) ~[%2380!/:?] {re:classloading}
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?] {}
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) ~[?:?] {}
	at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?] {}
	at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[?:?] {}
	at java.lang.reflect.Constructor.newInstance(Constructor.java:480) ~[?:?] {}
	at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:67) ~[javafmllanguage-1.18.2-40.1.0.jar%2377!/:?] {}
	at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:106) ~[fmlcore-1.18.2-40.1.0.jar%2379!/:?] {}
	at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) ~[?:?] {}
	at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796) ~[?:?] {}
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?] {}
	at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[?:?] {}
	at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?] {}
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?] {}
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?] {}

 

 

Posted
Quote

Exception message: java.lang.RuntimeException: Attempted to load class net/minecraft/client/multiplayer/ClientLevel for invalid dist DEDICATED_SERVER Stacktrace: at net.minecraftforge.fml.loading.RuntimeDistCleaner.processClassWithFlags(RuntimeDistCleaner.java:57) ~[fmlloader-1.18.2-40.1.0.jar:1.0] {} at 

-- snip --

java.lang.Class.privateGetDeclaredMethods(Class.java:3402) ~[?:?] {} at java.lang.Class.getDeclaredMethod(Class.java:2673) ~[?:?] {} at net.minecraftforge.eventbus.EventBus.getDeclMethod(EventBus.java:83) ~[eventbus-5.0.7.jar%239!/:?] {} at net.minecraftforge.eventbus.EventBus.lambda$registerObject$4(EventBus.java:95) ~[eventbus-5.0.7.jar%239!/:?] {} at

net.minecraftforge.eventbus.EventBus.register(EventBus.java:120) ~[eventbus-5.0.7.jar%239!/:?] {} at

com.sweetmimike.perfectmobfarm.PerfectMobFarm.<init>(PerfectMobFarm.java:67) ~[%2380!/:?] {re:classloading}

This is happening in your constructor when you register with the EventBus.

Forge is examining your class and it is finding a reference to ClientLevel either in one of your fields or method signatures during the classloading. It might not be direct, it could be referencing one of your other classes that needs to load ClientLevel.

Obviously, ClientLevel doesn't exist on the server so it crashes.

The usual way to solve this is to move the field or method to a different class that only gets referenced/loaded from inside your client method.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • How do I download mods for minecraft pe
    • I've tried multiple ways to get the chunk coordinates and none of them have worked, so I'm guessing it may be getChunk().  Is there another way to forcibly load a chunk on that same tick? If all else fails I guess I can just delay my action by a tick, but that's a pain in the butt and makes it more complex to provide appropriate feedback... Also welcome, Zander.  If you're searching for a similar solution, I hope this (eventually) helps you too 😅
    • My guess would be that you are not getting the chunk coordinates right, or getChunk dosnt work.
    • Hello, Recently I have been hosting an RLcraft server on Minecraft Forge Version 1.12.2 - 14.23.5.2860 I originally had lag issues and I chalked it up to playing on less than perfect hardware so I moved the server to better hardware(i9-9900k with 64GB of RAM for 1 player.) After lots of troubleshooting I discovered a couple of things. World saving was causing the MSPT to spike to over 2000Miliseconds and was happening every minute. This kind of makes sense as the world was pre-generated and is over 100GB. I learned that I could turn off world saving and just schedule that and that resolved that issue. After that issue was resolved I discovered another issue. It appears that when exploring chunks, any chunks explored stay loaded. They persist. I was originally thinking that this had to be a mod issue, but it didn't seem like anyone was talking about it. This isn't really a problem on packs with few worldgen mods or just few mods in general, but on beefier packs it becomes a problem. I went through forge changelogs and found this line. Build: 1.12.2-14.23.5.2841 - Thu Aug 29 01:58:50 GMT 2019 bs2609: Improve performance of persistent chunk checks (#5706) Is this a related item to what I am dealing with or just something else?   I went ahead and created a new dedicated server with Just Forge 14.23.5.2860, spark reforged, and it's core mods. I was able to replicate the issue and log it with spark. Hopefully you're able to see this spark profile. It basically shows that as I explored the chunk loading persisted(2000 chunks loaded over 10 minutes with one player)The view distance is set to 10 so that should be 200 chunks per player. If I don't move the loaded chunks are 200. I was however able to fix the persistent chunk issue if I save the world more frequently. My question is, is this intended function of the game or is this a bug? Everywhere I read seems to indicate Minecraft servers save every 5 minutes and not every minute. Can chunks not unload if the world does not autosave. Additionally. Autosave specifically appears to fix this issue. Manually running save-all does not resolve the issue.   I realize this is kind of a log one, sorry. Please let me know if you require further information. Thanks in advance for your time. https://spark.lucko.me/NvlMtC39Yt https://imgur.com/a/K0oyukx https://pastebin.com/z0qGu1Vh  
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.