Posted July 23, 201411 yr Upon exporting my mod, and placing it into a server, I'm getting a peculiar error. While singleplayer works perfectly fine, the server throws: Caused by: java.lang.NoClassDefFoundError: net/minecraft/client/entity/EntityClientPlayerMP This seems to suggest that my registration code is client side ony, but what is the server-side packet channel registration code? Here's the line throwing the error: PacketHandler.channels = NetworkRegistry.INSTANCE.newChannel("BetterRecords", new ChannelHandler()); It is currently under FMLInitializationEvent. Any help is greatly appreciated as this is the last thing I need before I may release said mod.
July 23, 201411 yr Unless you give us the full crash, we can't help you. Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! | mah twitter This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.
July 23, 201411 yr Author Sorry bout that, here ya go. [spoiler=Crash Report] ---- Minecraft Crash Report ---- // I just don't know what went wrong Time: 7/23/14 4:10 PM Description: Exception in server tick loop cpw.mods.fml.common.LoaderException: java.lang.NoClassDefFoundError: net/minecraft/client/entity/EntityClientPlayerMP at cpw.mods.fml.common.LoadController.transition(LoadController.java:162) at cpw.mods.fml.common.Loader.initializeMods(Loader.java:691) at cpw.mods.fml.server.FMLServerHandler.finishServerLoading(FMLServerHandler.java:97) at cpw.mods.fml.common.FMLCommonHandler.onServerStarted(FMLCommonHandler.java:318) at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:187) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:374) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:669) Caused by: java.lang.NoClassDefFoundError: net/minecraft/client/entity/EntityClientPlayerMP at com.codingforcookies.betterrecords.src.BetterRecords.init(BetterRecords.java:56) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:622) at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:622) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) at com.google.common.eventbus.EventBus.post(EventBus.java:267) at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:622) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) at com.google.common.eventbus.EventBus.post(EventBus.java:267) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) at cpw.mods.fml.common.Loader.initializeMods(Loader.java:690) ... 5 more Caused by: java.lang.ClassNotFoundException: net.minecraft.client.entity.EntityClientPlayerMP at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:323) at java.lang.ClassLoader.loadClass(ClassLoader.java:268) ... 33 more Caused by: java.lang.NullPointerException A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details: Minecraft Version: 1.7.2 Operating System: Linux (i386) version 2.6.32-042stab084.17 Java Version: 1.6.0_32, Sun Microsystems Inc. Java VM Version: OpenJDK Server VM (mixed mode), Sun Microsystems Inc. Memory: 879346272 bytes (838 MB) / 1029046272 bytes (981 MB) up to 1029046272 bytes (981 MB) JVM Flags: 2 total; -Xmx1024M -Xms1024M AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP v9.03 FML v7.2.211.1121 Minecraft Forge 10.12.2.1121 4 mods loaded, 4 mods active mcp{9.03} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized FML{7.2.211.1121} [Forge Mod Loader] (forge.jar) Unloaded->Constructed->Pre-initialized->Initialized Forge{10.12.2.1121} [Minecraft Forge] (forge.jar) Unloaded->Constructed->Pre-initialized->Initialized betterrecords{1.0.12} [better Records] (betterrecords-1.0.12.jar) Unloaded->Constructed->Pre-initialized->Errored Profiler Position: N/A (disabled) Is Modded: Definitely; Server brand changed to 'fml,forge' Type: Dedicated Server (map_server.txt)
July 23, 201411 yr Author I commented this out and tried it ont he server-side, and it worked. Turns out I had to make a function that was set to @SideOnly that returns the player for client side. packet.readBytes(data); switch(FMLCommonHandler.instance().getEffectiveSide()) { case CLIENT: packet.executeClient(getClient()); //packet.executeClient(Minecraft.getMinecraft().thePlayer); break; case SERVER: INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get(); packet.executeServer(((NetHandlerPlayServer)netHandler).playerEntity); break; } Thanks for the help!
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.