Entity spawn checks can potentially cause a server deadlock
noobanidus opened this issue ยท 0 comments
As per #1. From my understanding of the watchdog crash report, the server was waiting on chunk generation, while the chunk generation was waiting on the server. This seems to be a fundamental issue with the mobCondition
static function as defined in your Entities
class.
The only major difference I can see between that and the default Vanilla is the syntax is slightly different, and possibly in a way that could be causing the issue. Yours:
return spawnReason == SpawnReason.SPAWNER || world.getWorld().getBlockState(blockpos).canEntitySpawn(world, blockpos, entityType);
Vanilla:
return reason == SpawnReason.SPAWNER || worldIn.getBlockState(blockpos).canEntitySpawn(worldIn, blockpos, typeIn);
I believe that dereferencing the IWorld instance into an actual world is what's causing the problem. My understanding of the world generation code in 1.14 is a little bit fuzzy, but I believe what you are actually getting is an instance of WorldGenRegion
, which you can use getBlockState
etc for all of the relevant blocks as it translates it to the chunk currently being generated (and not yet existing in the world).
By trying to convert that back into the actual World
instance and then use that with getBlockState
, it then results in some sort of deadlock loop.
Changing your code to remove the getWorld()
should fix the problem immeditately.