Issues with mods glitching and crashing due to missing client-server communication

Submitted by TzX' on Thu, 02/08/2018 - 15:37
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

Submitted by Klemen on Fri, 02/09/2018 - 16:18

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

  • key bindings
  • fluids
  • events 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 imporant issue that was not discussed on the tracker before.

Submitted by Klemen on Sun, 04/22/2018 - 10:37

It is planned for the MCreator 2.x.x

Submitted by xanadian on Mon, 06/04/2018 - 21:19

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!

Submitted by smmmadden on Mon, 06/04/2018 - 23:39

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? 

Submitted by smmmadden on Tue, 06/05/2018 - 11:37

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?

Submitted by smmmadden on Fri, 06/08/2018 - 14:39

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!

Submitted by xanadian on Wed, 07/04/2018 - 13:22

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!

Submitted by smmmadden on Wed, 07/04/2018 - 14:31

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...

Submitted by Klemen on Wed, 07/04/2018 - 17:55

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.

Submitted by smmmadden on Wed, 07/04/2018 - 19:46

Do you happen to have an ETA on when and which build it'll be in?

Oh, OK,  I gotcha.  I've tried the @SideOnly kludge with a mod put on a server already, and am yet to see any *critical* problems...mostly just cosmetic things right now.  Thanks!

Submitted by smmmadden on Thu, 08/30/2018 - 13:23

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

Submitted by smmmadden on Thu, 08/30/2018 - 13:49

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