Ensure mobs don't spawn out of world border

this is originally what I thought #1333 was, but wasn't, but this is still valid fix
This commit is contained in:
Aikar
2018-09-17 21:50:02 -04:00
parent 97fc12e095
commit fda3e873f6
33 changed files with 53 additions and 46 deletions

View File

@@ -54,7 +54,7 @@ index ac85986a1a..06c5a54254 100644
};
Stream stream = StreamSupport.stream(BlockPosition.MutableBlockPosition.b(i, k, i1, j - 1, l - 1, j1 - 1).spliterator(), false).map((blockposition$mutableblockposition) -> {
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 561bcd07b3..94872593b1 100644
index 19eb905979..275978de83 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -71,6 +71,9 @@ index 561bcd07b3..94872593b1 100644
}
+ // Paper start
+ public boolean isLoadedAndInBounds(BlockPosition blockposition) {
+ return getWorldBorder().isInBounds(blockposition) && getChunkIfLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4) != null;
+ }
+ public Chunk getChunkIfLoaded(BlockPosition blockposition) {
+ return getChunkIfLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4);
+ }
@@ -109,6 +112,9 @@ index 561bcd07b3..94872593b1 100644
+ }
+ }
+ // reduces need to do isLoaded before getType
+ public IBlockData getTypeIfLoadedAndInBounds(BlockPosition blockposition) {
+ return getWorldBorder().isInBounds(blockposition) ? getTypeIfLoaded(blockposition) : null;
+ }
+ public IBlockData getTypeIfLoaded(BlockPosition blockposition) {
+ // CraftBukkit start - tree generation
+ if (captureTreeGeneration) {