From 90fd694c4c5b4a492a21208d78c722b3eeb13683 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 15 Sep 2018 13:46:01 -0400 Subject: [PATCH] Fix loop risk in mob spawning around unloaded chunks When a mob was about to load a chunk to try to spawn in, we did not increment the attempt counter, resulting in it being stuck in the mob spawn loop for a long time and hanging servers. --- ...wning-from-loading-generating-chunks.patch | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Spigot-Server-Patches/0369-Prevent-mob-spawning-from-loading-generating-chunks.patch b/Spigot-Server-Patches/0369-Prevent-mob-spawning-from-loading-generating-chunks.patch index 1942d69d0..2cc6b6fb8 100644 --- a/Spigot-Server-Patches/0369-Prevent-mob-spawning-from-loading-generating-chunks.patch +++ b/Spigot-Server-Patches/0369-Prevent-mob-spawning-from-loading-generating-chunks.patch @@ -1,31 +1,34 @@ -From d25983b197588722513fd00867c2f83fdec9f682 Mon Sep 17 00:00:00 2001 +From c3d2e0dd50ede77e547a3559419b45217c93afcb Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 12 Sep 2018 21:12:57 -0400 Subject: [PATCH] Prevent mob spawning from loading/generating chunks diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java -index 387570ed67..0661ea20d8 100644 +index 387570ed67..97ef41fe82 100644 --- a/src/main/java/net/minecraft/server/SpawnerCreature.java +++ b/src/main/java/net/minecraft/server/SpawnerCreature.java -@@ -129,7 +129,8 @@ public final class SpawnerCreature { +@@ -129,9 +129,9 @@ public final class SpawnerCreature { int i2 = blockposition1.getX(); int j2 = blockposition1.getY(); int k2 = blockposition1.getZ(); - IBlockData iblockdata = worldserver.getType(blockposition1); + IBlockData iblockdata = worldserver.getTypeIfLoaded(blockposition1); // Paper - don't load chunks for mob spawn -+ if (iblockdata == null) continue; // Paper - don't load chunks for mob spawn - if (!iblockdata.isOccluding()) { +- if (!iblockdata.isOccluding()) { ++ if (iblockdata != null && !iblockdata.isOccluding()) { // Paper - don't load chunks for mob spawn int l2 = 0; -@@ -168,6 +169,7 @@ public final class SpawnerCreature { + int i3 = 0; + +@@ -167,7 +167,7 @@ public final class SpawnerCreature { + i4 = biomebase_biomemeta.c + worldserver.random.nextInt(1 + biomebase_biomemeta.d - biomebase_biomemeta.c); } - if (worldserver.a(enumcreaturetype, biomebase_biomemeta, (BlockPosition) blockposition_mutableblockposition)) { -+ if (!worldserver.isLoaded(blockposition_mutableblockposition)) continue; // Paper - don't load chunks for mob spawn +- if (worldserver.a(enumcreaturetype, biomebase_biomemeta, (BlockPosition) blockposition_mutableblockposition)) { ++ if (worldserver.isLoaded(blockposition_mutableblockposition) && worldserver.a(enumcreaturetype, biomebase_biomemeta, (BlockPosition) blockposition_mutableblockposition)) { // Paper - don't load chunks for mob spawn EntityPositionTypes.Surface entitypositiontypes_surface = EntityPositionTypes.a(biomebase_biomemeta.b); if (entitypositiontypes_surface != null && a(entitypositiontypes_surface, worldserver, blockposition_mutableblockposition, biomebase_biomemeta.b)) { EntityInsentient entityinsentient; -- -2.18.0 +2.19.0