Custom block breaks, throws fatal NoClassDefFoundError

Published by smmmadden on
Status
Resolved
Issue description

Now that I've been able to finish the mod to work on a multiplayer world, when a player breaks these blocks, it throws a fatal exception in the console/logs.  I didn't have any compiling errors, so not sure why if fails in-game.  Could this be an issue with importing it from 1.7.9 to 1.8.0 ?  If so, is there a fix for it?  I don't get this issue when I break my other mod (also from 1.7.9) blocks.  The difference is those blocks are all "gravel" and these blocks are ores.  Do let me know what else you may need to help resolve it.  Thanks! -Steve

[23:04:01] [Server thread/FATAL] [minecraft/MinecraftServer]: Error executing task
java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: net/minecraft/client/Minecraft
        at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_181]
        at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_181]
        at net.minecraft.util.Util.func_181617_a(SourceFile:47) [h.class:?]
        at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:723) [MinecraftServer.class:?]
        at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:396) [nz.class:?]
        at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:668) [MinecraftServer.class:?]
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526) [MinecraftServer.class:?]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_181]
Caused by: java.lang.NoClassDefFoundError: net/minecraft/client/Minecraft
        at mod.mcreator.mcreator_malachiteBlock$BlockCustom.func_176206_d(mcreator_malachiteBlock.java:126) ~[mcreator_malachiteBlock$BlockCustom.class:?]
        at net.minecraft.server.management.PlayerInteractionManager.removeBlock(PlayerInteractionManager.java:275) ~[or.class:?]
        at net.minecraft.server.management.PlayerInteractionManager.func_180235_c(PlayerInteractionManager.java:265) ~[or.class:?]
        at net.minecraft.server.management.PlayerInteractionManager.func_180237_b(PlayerInteractionManager.java:309) ~[or.class:?]
        at net.minecraft.server.management.PlayerInteractionManager.func_180784_a(PlayerInteractionManager.java:154) ~[or.class:?]
        at net.minecraft.network.NetHandlerPlayServer.func_147345_a(NetHandlerPlayServer.java:691) ~[pa.class:?]
        at net.minecraft.network.play.client.CPacketPlayerDigging.func_148833_a(SourceFile:40) ~[lp.class:?]
        at net.minecraft.network.play.client.CPacketPlayerDigging.func_148833_a(SourceFile:10) ~[lp.class:?]
        at net.minecraft.network.PacketThreadUtil$1.run(SourceFile:13) ~[hv$1.class:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_181]
        at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_181]
        at net.minecraft.util.Util.func_181617_a(SourceFile:46) ~[h.class:?]
        ... 5 more
Caused by: java.lang.ClassNotFoundException: net.minecraft.client.Minecraft
        at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:101) ~[launchwrapper-1.12.jar:?]
        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_181]
        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_181]
        at mod.mcreator.mcreator_malachiteBlock$BlockCustom.func_176206_d(mcreator_malachiteBlock.java:126) ~[mcreator_malachiteBlock$BlockCustom.class:?]
        at net.minecraft.server.management.PlayerInteractionManager.removeBlock(PlayerInteractionManager.java:275) ~[or.class:?]
        at net.minecraft.server.management.PlayerInteractionManager.func_180235_c(PlayerInteractionManager.java:265) ~[or.class:?]
        at net.minecraft.server.management.PlayerInteractionManager.func_180237_b(PlayerInteractionManager.java:309) ~[or.class:?]
        at net.minecraft.server.management.PlayerInteractionManager.func_180784_a(PlayerInteractionManager.java:154) ~[or.class:?]
        at net.minecraft.network.NetHandlerPlayServer.func_147345_a(NetHandlerPlayServer.java:691) ~[pa.class:?]
        at net.minecraft.network.play.client.CPacketPlayerDigging.func_148833_a(SourceFile:40) ~[lp.class:?]
        at net.minecraft.network.play.client.CPacketPlayerDigging.func_148833_a(SourceFile:10) ~[lp.class:?]
        at net.minecraft.network.PacketThreadUtil$1.run(SourceFile:13) ~[hv$1.class:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_181]
        at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_181]
        at net.minecraft.util.Util.func_181617_a(SourceFile:46) ~[h.class:?]
        ... 5 more

Issue comments

or is it that I need to remove all particle effects on my tools, ingots, ores and armors too?  That's the change I needed to get the mod to compile for MP.  I'll test this theory in the morning assuming I don't hear back before then.

Could you share the workspace file? If you are using any events, keep in mind that some of them are not SMP compatible yet.

Which one or do you need all of them zipped up?  Is there a list of which ones are or are not?  I am using some events like set redstone power to true, giving a book on command, etc. 

I removed the turn redstone on and turn redstone off procedures for each of the blocks and that stopped the exceptions.  Not ideal of course, since I wanted these blocks to be redstone enabled.  Is there an alternate way to do this in 1.8.0?

Block is placed - redstone is enabled

Block is destroyed (by anyone/anything) - redstone is disabled

You can do this by using these events, but then lock the code and remove the following lines in the block code:

EntityPlayer entity = Minecraft.getMinecraft().player;

Of course, in such case, you can't use entity dependency, which is not required for the redstone event.

MP compatibility is being improved, but this is a long process as thing get quite complicated on MP.

Ticket on this topic: https://mcreator.net/tracker/issue/40695

Thanks Klemen, I re-added the two procedures (turn on and turn off), then edited the code to remove the row mentioned from both the When block destroyed by explosion and When block destroyed by player.

Placing the block is not enabling redstone.  Is it that I need the EntityPlayer entity = Minecraft.getMinecraft().player; only for the player section and NOT for the explosion section of the code?

got it and got it working using that local change.  I also just realized that once I edit the code (unlock it), I can't lock it again or it will regenerate it with those statements back in.  This is expected right?  Thanks for the support, very much appreciated!