Fix a case where mob spawning could load/gen chunks

This commit is contained in:
Aikar 2019-03-24 00:59:45 -04:00
parent b587621ad9
commit 81ff6e67f5
No known key found for this signature in database
GPG Key ID: 401ADFC9891FAAFE

View File

@ -1,4 +1,4 @@
From 8b1bb76c61044895a83195a93978c5ba1af14de5 Mon Sep 17 00:00:00 2001
From 486bdf075eb79ddb255338c537871df4d7a2742a Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 12 Sep 2018 21:12:57 -0400
Subject: [PATCH] Prevent mob spawning from loading/generating chunks
@ -6,7 +6,7 @@ Subject: [PATCH] Prevent mob spawning from loading/generating chunks
also prevents if out of world border bounds
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index bfbe4d3e3..e2bf17f44 100644
index bfbe4d3e39..17bb81c03e 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -129,9 +129,9 @@ public final class SpawnerCreature {
@ -21,15 +21,15 @@ index bfbe4d3e3..e2bf17f44 100644
int l2 = 0;
int i3 = 0;
@@ -171,7 +171,7 @@ public final class SpawnerCreature {
i4 = biomebase_biomemeta.c + worldserver.random.nextInt(1 + biomebase_biomemeta.d - biomebase_biomemeta.c);
}
@@ -158,7 +158,7 @@ public final class SpawnerCreature {
float f1 = (float) l3 + 0.5F;
EntityHuman entityhuman1 = worldserver.a((double) f, (double) f1, -1.0D);
- if (worldserver.a(enumcreaturetype, biomebase_biomemeta, (BlockPosition) blockposition_mutableblockposition)) {
+ if (worldserver.isLoadedAndInBounds(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;
- if (entityhuman1 != null) {
+ if (entityhuman1 != null && worldserver.isLoadedAndInBounds(blockposition_mutableblockposition)) { // Paper - don't load chunks for mob spawn
double d0 = entityhuman1.d((double) f, (double) k3, (double) f1);
if (d0 > 576.0D && blockposition.distanceSquared((double) f, (double) k3, (double) f1) >= 576.0D) {
--
2.21.0