Ender IO Zoo

Ender IO Zoo

962k Downloads

Connection Lost Issue

Jay9519 opened this issue ยท 5 comments

commented

Issue Description:

Updating my server to version 190 and the server starts up fine but when I try and join,
the server crashes


Affected Versions (Do not use "latest"):

  • EnderIO: 1.10.2-3.1.190
  • EnderCore: 1.10.2-0.4.1.66
  • Minecraft: 1.10.2
  • Forge: 1.10.2-12.18.3.2297-universal

Your most recent log file where the issue was present:

[pastebin/gist/etc link here]

Crash Report
https://pastebin.com/ic1PsMDk

commented

PS: Please report this to Sponge and add this information:

This crash cannot be fixed by Ender IO. Java does not support calling non-final methods from the constructor. It isn't actively stopping you doing it, and under certain circumstances it works fine---e.g. if the method does not access this. Here, however, doing so is completely unnecessary; the World class has a init() method that is called directly after the object is constructed:

net.minecraft.server.MinecraftServer.loadAllWorlds(...) {
...
WorldServer world = new WorldServer(...).init();
commented

I have confirmed that the newest version crashes my server when a Farming Station is placed in the world

commented

That's not Ender IO, that is this code:

at net.minecraft.world.World.handler$onConstructed$zjp000(World.java:4784)

which is patched in by some other software and does funky thinks before the World object is fully constructed. Calling methods on a non-final object from the constructor is not supported by Java.

commented

Fixed with a workaround as you suggested to use the init() method instead, however I would like to point something out:

While the issue is in fact a problem of initialization ordering, there's something that your PickupWorld is overcomplicating: Using the wrapper object without utilizing the already existing fields of the wrapped world for the call to the super constructor.

Here, you're calling the super constructor with null WorldInfo objects, instead of utilizing the wrapper.getWorldInfo(), which would recycle the use of the now wrapped WorldInfo object. If you were to recycle that usage and call instead:

  public PickupWorld(World wrapped, FakePlayerEIO player) {
    super(wrapped.getSaveHandler(), wrapped.getWorldInfo(), wrapped.provider, null, false);
    this.wrapped = wrapped;
    this.player = player;
  }

You would not have to override a few methods, including getWorldInfo(), getSaveHandler(), and a few other ones that involve those two objects.

That being said, it is the fault of Sponge for expecting something to not be overridden or initialized, but just passing around some potentially beneficial knowledge.

This issue should be closed now since SpongeForge builds with the fix are now published and deployed.

commented

I already added those modifications, I just didn't check them in because some people ignore their issues if the other side has a workaround. In this case it was a value I could do this for by chance, but I'd rather have this fixed for all cases.

BTW, I originally left those out because I wanted to avoid side effects from other mods adding their hooks into them. ;)