The Lost Cities

The Lost Cities

59M Downloads

getDefaultCreatures causing server crash?

LemADEC opened this issue ยท 10 comments

commented

As of compatlayer-1.10-0.3.0 + lostcities-1.1x-1.0.2, we're experiencing server crashes during mob spawning.
It happens in single player, or when a player logs in on our freshly started server.
In both cases, Sponge was installed, through I'm not sure how it would affect the issue here.

In Single player:

java.lang.NullPointerException: Exception ticking world
	at net.minecraft.world.gen.structure.MapGenStructure.func_143027_a(MapGenStructure.java:224)
	at net.minecraft.world.gen.structure.MapGenStructure.func_175795_b(MapGenStructure.java:102)
	at mcjty.lostcities.dimensions.world.LostCityChunkGenerator.getDefaultCreatures(LostCityChunkGenerator.java:555)
	at mcjty.lostcities.dimensions.world.LostCityChunkGenerator.func_177458_a(LostCityChunkGenerator.java:548)
	at org.spongepowered.common.world.gen.SpongeChunkGenerator.func_177458_a(SpongeChunkGenerator.java:428)
	at net.minecraft.world.gen.ChunkProviderServer.func_177458_a(ChunkProviderServer.java:298)
	at net.minecraft.world.WorldServer.func_175734_a(WorldServer.java:239)
	at net.minecraft.world.WorldEntitySpawner.func_77192_a(WorldEntitySpawner.java:740)
	at net.minecraft.world.WorldServer.func_72835_b(WorldServer.java:198)
	at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:698)
	at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:613)
	at net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:149)
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:471)
	at java.lang.Thread.run(Unknown Source)

In dedicated server:

java.lang.NullPointerException: Exception ticking world
	at net.minecraft.world.gen.structure.MapGenStructure.func_143027_a(MapGenStructure.java:224)
	at net.minecraft.world.gen.structure.MapGenStructure.func_175795_b(MapGenStructure.java:102)
	at mcjty.lostcities.dimensions.world.LostCityChunkGenerator.getDefaultCreatures(LostCityChunkGenerator.java:555)
	at mcjty.lostcities.dimensions.world.LostCityChunkGenerator.func_177458_a(LostCityChunkGenerator.java:548)
	at org.spongepowered.common.world.gen.SpongeChunkGenerator.func_177458_a(SpongeChunkGenerator.java:428)
	at net.minecraft.world.gen.ChunkProviderServer.func_177458_a(ChunkProviderServer.java:298)
	at net.minecraft.world.WorldServer.func_175734_a(WorldServer.java:239)
	at net.minecraft.world.WorldEntitySpawner.func_77192_a(WorldEntitySpawner.java:740)
	at net.minecraft.world.WorldServer.func_72835_b(WorldServer.java:198)
	at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:698)
	at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:387)
	at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:613)
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:471)
	at java.lang.Thread.run(Thread.java:748)

Any idea what's causing it? maybe an option we could disable in our profile?

commented

Sponge hasn't fixed the previous issues with the chunkgenerator wrapper, and they don't support 1.10 anymore.
So, I need to address it on LostCities side. Which come back to my initial questions on whether you guys have any idea on what's causing it? and if there's profile option to workaround it?

commented

There's really no good way for us to fix this on our side, and we don't really do non-critical maintenance on 1.10 anymore either. Your only real choices are to update to 1.12, remove Lost Cities, or remove Sponge.

commented
commented

SpongeForge is a highly invasive coremod that breaks a lot of things. Can you try temporarily removing it and seeing if that makes this issue go away? If that fixes it, report this to their issue tracker. If not, post the new crash report.

commented

1.12 has the same problem, I guess we'll drop the mod on our public modpacks then

commented

If 1.12 has the problem, Sponge should be willing to fix it there.

commented

Lost Cities calls the generate of MapGenScatteredFeature like this:

        this.scatteredFeatureGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);

And the world given there is always valid so without Sponge this will never crash. For reference, the code of that generate function starts as follows:

public void generate(World worldIn, int x, int z, ChunkPrimer primer)
{
    int i = this.range;
    this.world = worldIn;
    this.rand.setSeed(worldIn.getSeed());
commented

Do we ever call isInsideStructure having not yet called generate? Could that be the cause?

commented

func_175795_b/isInsideStructure()
is called by getDefaultCreatures()
which is called by func_177458_a/getPossibleCreatures().

The latest is a public method that can be called by anyone without having generated a structure beforehand.

Vanilla/Forge calls it to check for possible creature to spawn at a location.

I don't understand why it works with just Forge. What part of the code cause the world property to be set if no generation happens?

commented

Issue is due to world object being null inside the Temple's instance of MapGenScatteredFeature called by LostCities.
In the MapGen classes, the World object is only set during actual chunk generation or checking for stronghold position (probably through eye of ender?).
I see no warranty that the world would be initialized before the this.scatteredFeatureGenerator.isInsideStructure(pos) statement.
If that's the case, it's just mere luck that it doesn't crash without Sponge.