Issues with mods crashing Minecraft Server

Published by TzX' on
Status
Fixed
Issue description

I know that every body have this problem but , How can I put my mod on an server , the client mods is useless , who will play on minecraft wit an client mod that add thing like dimension or block ?

Issue comments

We can confirm that under some conditions mods don't work on servers. Some of the common cases are:

  • key bindings
  • fluids
  • events/procedures in general
  • custom 3D models

We will do our best to improve the multiplayer compatibility in the near future. I am rising priority of this issue as this is an important issue that was not discussed on the tracker before.

Klemen, as you requested I brought my findings over to this thread.  I'm not running a server (but intend to at some point).  And, you've already mentioned there's an issue with events.  I don't know how much testing you've done with procedures and events, but I've done a bit (though it's far from thorough).  I've discovered that as far as events go, blocks seem to be the biggest culprit.  Almost every event has weird behavior regarding procedures *except* for "On block right-clicked," and "When start to destroy."  Those events work perfectly fine.  There is also a not-as-serious issue with over-time events (i.e. anything that re-applies an action at specific intervals, like Regeneration) when applied to armor.  In Regeneration's case, the heal-over-time effect is almost instantaneous when (for Regen 1) it should be 1/2 heart every 50 ticks.  Removing the armor will allow the Regen timer to run as expected, and the heal-over-time effect then works as it should.

I don't know if you want me to share what else I've found here or not.  You've probably already tested for all possible cases...

 

Thanks!

Compilation fails when using the run server option.  I thought that my procedures may be causing it so I removed them and tried again with the same results shown here.  https://pastebin.com/by4Y6g2R

Earlier I posted the same issue but given that I had a number of typos and had done a lot of cleanup, I thought it must have been me.  So I started a new workspace from scratch and re-built the mod.  i left out achievements, but left in the procedures and a few commands (basically a help command).  Same compiler exceptions when trying to use server.  Pulled out procedures and commands and still the same results.  I'm not able to confirm that events is causing the problem.

I find it odd (maybe intentional), that we get a java.lang.NoClassDefFoundError: net/minecraft/client/entity/EntityPlayerSP when running the server or putting the mod in a server.  I wouldn't expect a call into minecraft/client/EntityPlayerSP.jar but would expect to call minecraft/entity/player/EntityPlayerMP since it no longer is about a single player, it's about multiple players and that class as it states would not be there.  Or is this more complicated than just an incorrect pointer? 

Just to add one more data point.  My first mod posted here as well is TmTmc-Gravels and basically, that's all it had in it and that worked for Client and Server without issue.  The significant difference is that no particle effects used, they have gravity (so they behave like vanilla gravel/sand) and they are destroyed using shovels instead of pickaxes. My second mod adds 4 new ore blocks, ingots, coal, armor, effects, etc.  So perhaps the disconnect has something to do with the tool used, gravity or effects?  I did try adding effects to the gravel, but that failed to compile properly if that helps?

Hi - is there any update on the above if that is the issue or a local change we can make to get around it?  Thanks!

I don't know if this is of any use or not, but:

 

Server-side mods crashing due to "EntityPlayerSP" not being defined.  Are people only getting this when they've created their mod based off of an imported workspace from a previous version of MCreator?

Also:  since I figured I'm crazy enough to edit the code directly, I'd go looking for "EntityPlayerSP" in the offending mod element(s) (or at least, the element that caused *my* crash).  It's not in there.  Is it somehow getting called from another method?  And if so, where do I find *that* method?  

 

Thanks!

I didn't do any import, but based on my comment of Mon, 06/04/2018 - 23:39, I think that we're simply making the wrong call.  EntityPlayerSP is only available for single player private worlds, not for multiplayer servers which I believe should have been a call to minecraft/entity/player/EntityPlayerMP

I'm hoping that it is literally that simple but there could be other calls that may fail once this is tested.

Starting a server from MCreator will fail since it calls EntityPlayerSP

Starting an external server (Forge multiplayer world) will also fail since it too calls EntityPlayerSP

Anyway to test this theory out?  Thanks - Steve

Oh, lol, I just figured out why Klemen mentioned this problem exists in fluids and some procedures.  Anything with a visual effect (i.e., fluids moving, particles coming off a block) causes the issue.  I'm sure there's more to it than that.

Also, it appears that I was barking up the wrong tree with the whole "importing a workspace from an older version" bit, so forget about that.

 

Also also, it seems that adding "@SideOnly(Side.CLIENT)" before any code block that includes "EntityPlayer entity = Minecraft.getMinecraft().player" in it allows the mod to run on a server, BUT it seems to disable particle effects (and I'm sure other things I'm yet to discover).  At least I can now use my mod on a server, though...

Using @SideOnly(Side.CLIENT) can fix some crashes, but the logic becomes even more buggy in such cases. We need to implement server/client communication support, so events are sent to the server from client and the other way around too. This will require quite a lot of changes in MCreator to completely fix this, but we are working on getting things towards achieving this with each update.

Removing Particle effects on my mod that couldn't compile for multiplayer server fixed the issue after importing it to 1.8.0.  So it appears to just be isolated to "block" type items having effects set to them.  Sad that it can't have the effects, but elated that I can now inform players my mod can be played on MP Servers. :-)  Thanks All! -Steve

Thank you - as I'm sure a lot of it depended on the new release of 1.8.0 - so I'm giving credit where it is rightfully due. :-)  Nice work!

Try to change any EntityPlayerSP into EntityPlayerMP or EntityPlayer. Also trying the @SideOnly(Side.CLIENT) works while referencing that the world is in remote. Hope I helped ;)

You who are big Minecraft knowers, how do i play Modded Multiplayer/server with friends? With our own mods?

 

When i opened Minecraft Forge App and i choosed Server instand of client, i don't know what to do next

I'm guessing this error is relevant:

 

java.lang.NoClassDefFoundError: net/minecraft/client/renderer/entity/RenderLivingBase

Further on, the output *does* say it's server-side.  I have no idea which mod element is throwing this, though.  If it were a particle effect on a block, the error would tell me which mod element was causing problems.  This error is more non-specific.  I hope it doesn't mean that I'll have to delete *all* my custom NPCs.  Some I don't mind losing, some I need to keep.

I dug through the code of several of my NPCs, and *none* of them refer to EntityPlayerSP...or any player at all except in import.  So maybe this is something new?

This is for both MCreator 1.8.1 and 1.8.2, btw.  If there's something else specific I should be changing in the code of the mod element(s), I think I'm confident enough to do it.  Maybe.

Thanks!

Ah, the next line in the error told me where to find the offending mob.  I had to look in <modname> itself, not in any of the elements.  It's not a custom *model*, though...but it has a custom skin, using the "Built-in" biped model.

We have fixed most of the cases of SMP issues. Now mobs don't crash the server and there are no more EntityPlayerSP related crashes. We had to remove entity as provided dependency on some procedures to achieve this as they were accessed in an incorrect way.

Now, most mods will be multiplayer compatible. I am closing this ticket as it will be fixed in 1.8.3. There can still be some rare issues with some procedure combinations (but not crashes) but we will cover these in separate tickets.