Prevent mob spawning from loading/generating chunks
also prevents if out of world border bounds
This commit is contained in:
@@ -48,6 +48,27 @@
|
|||||||
list.add(enumcreaturetype);
|
list.add(enumcreaturetype);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -164,9 +185,9 @@
|
||||||
|
StructureManager structuremanager = world.structureManager();
|
||||||
|
ChunkGenerator chunkgenerator = world.getChunkSource().getGenerator();
|
||||||
|
int i = pos.getY();
|
||||||
|
- BlockState iblockdata = chunk.getBlockState(pos);
|
||||||
|
+ BlockState iblockdata = world.getBlockStateIfLoadedAndInBounds(pos); // Paper - don't load chunks for mob spawn
|
||||||
|
|
||||||
|
- if (!iblockdata.isRedstoneConductor(chunk, pos)) {
|
||||||
|
+ if (iblockdata != null && !iblockdata.isRedstoneConductor(chunk, pos)) { // Paper - don't load chunks for mob spawn
|
||||||
|
BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
|
||||||
|
int j = 0;
|
||||||
|
int k = 0;
|
||||||
|
@@ -195,7 +216,7 @@
|
||||||
|
if (entityhuman != null) {
|
||||||
|
double d2 = entityhuman.distanceToSqr(d0, (double) i, d1);
|
||||||
|
|
||||||
|
- if (NaturalSpawner.isRightDistanceToPlayerAndSpawnPoint(world, chunk, blockposition_mutableblockposition, d2)) {
|
||||||
|
+ if (world.isLoadedAndInBounds(blockposition_mutableblockposition) && NaturalSpawner.isRightDistanceToPlayerAndSpawnPoint(world, chunk, blockposition_mutableblockposition, d2)) { // Paper - don't load chunks for mob spawn
|
||||||
|
if (biomesettingsmobs_c == null) {
|
||||||
|
Optional<MobSpawnSettings.SpawnerData> optional = NaturalSpawner.getRandomSpawnMobAt(world, structuremanager, chunkgenerator, group, world.random, blockposition_mutableblockposition);
|
||||||
|
|
||||||
@@ -207,7 +228,13 @@
|
@@ -207,7 +228,13 @@
|
||||||
j1 = biomesettingsmobs_c.minCount + world.random.nextInt(1 + biomesettingsmobs_c.maxCount - biomesettingsmobs_c.minCount);
|
j1 = biomesettingsmobs_c.minCount + world.random.nextInt(1 + biomesettingsmobs_c.maxCount - biomesettingsmobs_c.minCount);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user