Jump to content

Crash when spawning entity in SMP.


Recommended Posts

Whenever I try to spawn an entity that belongs to my mod in SMP, it throws this error and crashes.


2012-12-23 21:33:03 [sEVERE] [Minecraft] Encountered an unexpected exception NoClassDefFoundError
java.lang.NoClassDefFoundError: net/minecraft/client/entity/EntityClientPlayerMP
at mca.ItemEggMale.spawnVillager(ItemEggMale.java:105)
at mca.ItemEggMale.onItemUse(ItemEggMale.java:83)
at net.minecraft.item.ItemStack.tryPlaceItemIntoWorld(ItemStack.java:135)
at net.minecraft.item.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:424)
at net.minecraft.network.NetServerHandler.handlePlace(NetServerHandler.java:579)
at net.minecraft.network.packet.Packet15Place.processPacket(Packet15Place.java:79)
at net.minecraft.network.TcpConnection.processReadPackets(TcpConnection.java:454)
at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:137)
at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:57)
at net.minecraft.server.dedicated.DedicatedServerListenThread.networkTick(DedicatedServerListenThread.java:34)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:702)
at net.minecraft.server.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:270)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:598)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:497)
at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
Caused by: java.lang.ClassNotFoundException: net.minecraft.client.entity.EntityClientPlayerMP
at cpw.mods.fml.relauncher.RelaunchClassLoader.findClass(RelaunchClassLoader.java:179)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 15 more
Caused by: java.lang.RuntimeException: Attempted to load class net/minecraft/client/entity/EntityClientPlayerMP for invalid side SERVER
at cpw.mods.fml.common.asm.transformers.SideTransformer.transform(SideTransformer.java:38)
at cpw.mods.fml.relauncher.RelaunchClassLoader.runTransformers(RelaunchClassLoader.java:222)
at cpw.mods.fml.relauncher.RelaunchClassLoader.findClass(RelaunchClassLoader.java:171)
... 17 more


I understand what the error means, but neither the egg nor the entity reference EntityClientPlayerMP anywhere. The only kind of player I use is EntityPlayer.


Code for the egg: http://pastebin.com/HHReW9R2

Code for the entity: http://pastebin.com/1jjAsd6N


Why is this happening if I don't use EntityClientPlayerMP?

Link to comment
Share on other sites

1) if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) is bad, and expensive. Use World.isRemote

2) Why did you pastebin partial classes? The error clearly states the it's on line 105 but your class only has 103

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Link to comment
Share on other sites

Ugh, getting tired of asking for your complete code as I said SOMEWHERE you're referring to EntityClient

Zip your entire code and post it.


The more code you post shows the more classes that you're not posting.


        public FamilyTree familyTree = new FamilyTree(this);
        public ChoreCombat combatChore = new ChoreCombat(this);
        public ChoreFarming farmingChore = new ChoreFarming(this);
        public ChoreFishing fishingChore = new ChoreFishing(this);
        public ChoreWoodcutting woodcuttingChore = new ChoreWoodcutting(this);
        public ChoreMining  miningChore = new ChoreMining(this);
        public Inventory inventory = new Inventory(this);

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Link to comment
Share on other sites

Oh my god, so many hard references to client side only classes its ridiculousness.

Also, you seriously need to fix your instalation process, death on your config folder not being there, my god those 15 errors were so fucking annoying to fix 1 by one.


Anyways shit like this creates a hard reference:


ModLoader.openGUI(entityPlayer, new GuiInteractionVillagerAdult(this, entityPlayer));

Hard reference to GuiScreen

if (hearts > 100 && !Minecraft.getMinecraft().statFileWriter.hasAchievementUnlocked(MCA.instance.achievementCharmer))

Hard reference to Minecraft {yes even when sourrounded by 'getEffectiveSide' checks {which, again, is stupid and waistful.


Not only hard reference to Minecraft, but also to EntityClientPlayerMP as thts what 'thePlayer' is.


Its ridiculousness trying to track down all the hard references.

Here is a tip, go to forge/mcp/src/minecraft and re-name 'client' to '______'

And then fix all the errors that are in your package.



I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Link to comment
Share on other sites

Got that all figured out but now it's having some problem with packets.


Client Side

2012-12-24 15:16:04 [iNFO] [sTDOUT] Connecting to, 25565
2012-12-24 15:16:06 [iNFO] [sTDOUT] Minecraft Comes Alive CLIENT: SENT SYNC REQUEST 173
2012-12-24 15:16:06 [iNFO] [sTDOUT] Minecraft Comes Alive CLIENT: [b@2158592a
2012-12-24 15:16:06 [iNFO] [sTDOUT] Minecraft Comes Alive CLIENT: SENT SYNC REQUEST 177
2012-12-24 15:16:06 [iNFO] [sTDOUT] Minecraft Comes Alive CLIENT: [b@15de4ebf


Server Side

2012-12-24 15:16:06 [iNFO] [sTDOUT] Minecraft Comes Alive SERVER: Received packet: MCA_SYNC_REQ
2012-12-24 15:16:06 [iNFO] [sTDERR] java.lang.NullPointerException
2012-12-24 15:16:06 [iNFO] [sTDERR] 	at java.io.ByteArrayInputStream.<init>(Unknown Source)
2012-12-24 15:16:06 [iNFO] [sTDERR] 	at mca.PacketHandler.handleSyncRequest(PacketHandler.java:458)
2012-12-24 15:16:06 [iNFO] [sTDERR] 	at mca.PacketHandler.onPacketData(PacketHandler.java:95)
2012-12-24 15:16:06 [iNFO] [sTDERR] 	at cpw.mods.fml.common.network.NetworkRegistry.handlePacket(NetworkRegistry.java:243)
2012-12-24 15:16:06 [iNFO] [sTDERR] 	at cpw.mods.fml.common.network.NetworkRegistry.handleCustomPacket(NetworkRegistry.java:233)
2012-12-24 15:16:06 [iNFO] [sTDERR] 	at cpw.mods.fml.common.network.FMLNetworkHandler.handlePacket250Packet(FMLNetworkHandler.java:71)
2012-12-24 15:16:06 [iNFO] [sTDERR] 	at net.minecraft.network.NetServerHandler.handleCustomPayload(NetServerHandler.java:1111)
2012-12-24 15:16:06 [iNFO] [sTDERR] 	at net.minecraft.network.packet.Packet250CustomPayload.processPacket(Packet250CustomPayload.java:70)
2012-12-24 15:16:06 [iNFO] [sTDERR] 	at net.minecraft.network.TcpConnection.processReadPackets(TcpConnection.java:454)
2012-12-24 15:16:06 [iNFO] [sTDERR] 	at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:137)
2012-12-24 15:16:06 [iNFO] [sTDERR] 	at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:57)
2012-12-24 15:16:06 [iNFO] [sTDERR] 	at net.minecraft.server.dedicated.DedicatedServerListenThread.networkTick(DedicatedServerListenThread.java:34)
2012-12-24 15:16:06 [iNFO] [sTDERR] 	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:702)
2012-12-24 15:16:06 [iNFO] [sTDERR] 	at net.minecraft.server.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:270)
2012-12-24 15:16:06 [iNFO] [sTDERR] 	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:598)
2012-12-24 15:16:06 [iNFO] [sTDERR] 	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:497)
2012-12-24 15:16:06 [iNFO] [sTDERR] 	at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2012-12-24 15:16:06 [iNFO] [sTDERR] java.io.IOException: Bad packet id 172
2012-12-24 15:16:06 [iNFO] [sTDERR] 	at net.minecraft.network.packet.Packet.readPacket(Packet.java:151)
2012-12-24 15:16:06 [iNFO] [sTDERR] 	at net.minecraft.network.TcpConnection.readPacket(TcpConnection.java:320)
2012-12-24 15:16:06 [iNFO] [sTDERR] 	at net.minecraft.network.TcpConnection.readNetworkPacket(TcpConnection.java:540)
2012-12-24 15:16:06 [iNFO] [sTDERR] 	at net.minecraft.network.TcpReaderThread.run(TcpReaderThread.java:23)
2012-12-24 15:16:06 [iNFO] [Minecraft] Player172 lost connection: disconnect.genericReason


The data is sent correctly, as you can see in the Client log. In the case of the MCA_SYNC_REQ packet it is an entity's ID. However when the server receives it, data is null. If I skip sending the sync packet, I can successfully log in to the server. However when I send any other kind of packet, the same thing happens: no data in the received packet when there was data in it when it was sent.


I have a feeling this is something simple I'm missing. Here's my updated source, all hard references to the client removed: https://dl.dropbox.com/u/64124307/Minecraft%20Comes%20Alive/Build/SRC.zip

Link to comment
Share on other sites

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.

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.


  • Create New...

Important Information

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