summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2017-05-20 11:27:48 +1000
committermd_5 <git@md-5.net>2017-05-20 11:28:38 +1000
commitcda27c992d261aad19886e7427c2caa22b3f0c12 (patch)
treedf49ea885cd4b05f46b8e3c51914451762cb155f
parent4377dac1388c04f887edf40c2c048288f58f3ec2 (diff)
downloadcraftbukkit-cda27c992d261aad19886e7427c2caa22b3f0c12.tar
craftbukkit-cda27c992d261aad19886e7427c2caa22b3f0c12.tar.gz
craftbukkit-cda27c992d261aad19886e7427c2caa22b3f0c12.tar.lz
craftbukkit-cda27c992d261aad19886e7427c2caa22b3f0c12.tar.xz
craftbukkit-cda27c992d261aad19886e7427c2caa22b3f0c12.zip
SPIGOT-3254: Check chunks are loaded before ticking entities as per previous versions.
-rw-r--r--nms-patches/World.patch42
1 files changed, 28 insertions, 14 deletions
diff --git a/nms-patches/World.patch b/nms-patches/World.patch
index 4686f777..a123bfb6 100644
--- a/nms-patches/World.patch
+++ b/nms-patches/World.patch
@@ -448,7 +448,21 @@
}
}
}
-@@ -1252,6 +1501,7 @@
+@@ -1241,6 +1490,13 @@
+ }
+
+ public void entityJoinedWorld(Entity entity, boolean flag) {
++ // CraftBukkit start - check if chunks are loaded as done in previous versions
++ Chunk startingChunk = this.getChunkIfLoaded(MathHelper.floor(entity.locX) >> 4, MathHelper.floor(entity.locZ) >> 4);
++ if (flag && !(startingChunk != null && startingChunk.areNeighborsLoaded(2))) {
++ return;
++ }
++ // CraftBukkit end
++
+ entity.M = entity.locX;
+ entity.N = entity.locY;
+ entity.O = entity.locZ;
+@@ -1252,6 +1508,7 @@
entity.leaveVehicle();
} else {
entity.B_();
@@ -456,7 +470,7 @@
}
}
-@@ -1543,11 +1793,18 @@
+@@ -1543,11 +1800,18 @@
}
}
@@ -475,7 +489,7 @@
TileEntity tileentity = null;
if (this.O) {
-@@ -1582,6 +1839,14 @@
+@@ -1582,6 +1846,14 @@
public void setTileEntity(BlockPosition blockposition, @Nullable TileEntity tileentity) {
if (!this.E(blockposition)) {
if (tileentity != null && !tileentity.y()) {
@@ -490,7 +504,7 @@
if (this.O) {
tileentity.setPosition(blockposition);
Iterator iterator = this.b.iterator();
-@@ -1741,6 +2006,14 @@
+@@ -1741,6 +2013,14 @@
}
this.o = MathHelper.a(this.o, 0.0F, 1.0F);
@@ -505,7 +519,7 @@
}
}
}
-@@ -1878,7 +2151,10 @@
+@@ -1878,7 +2158,10 @@
}
public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition) {
@@ -517,7 +531,7 @@
return false;
} else {
int i = 0;
-@@ -2045,7 +2321,7 @@
+@@ -2045,7 +2328,7 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@@ -526,7 +540,7 @@
arraylist.add(entity);
}
}
-@@ -2060,7 +2336,7 @@
+@@ -2060,7 +2343,7 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@@ -535,7 +549,7 @@
arraylist.add(entity);
}
}
-@@ -2109,7 +2385,7 @@
+@@ -2109,7 +2392,7 @@
}
}
@@ -544,7 +558,7 @@
}
@Nullable
-@@ -2130,8 +2406,17 @@
+@@ -2130,8 +2413,17 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@@ -563,7 +577,7 @@
++i;
}
}
-@@ -2140,12 +2425,18 @@
+@@ -2140,12 +2432,18 @@
}
public void a(Collection<Entity> collection) {
@@ -583,7 +597,7 @@
this.b(entity);
}
-@@ -2159,7 +2450,13 @@
+@@ -2159,7 +2457,13 @@
IBlockData iblockdata = this.getType(blockposition);
AxisAlignedBB axisalignedbb = flag ? null : block.getBlockData().d(this, blockposition);
@@ -598,7 +612,7 @@
}
public int getSeaLevel() {
-@@ -2269,6 +2566,11 @@
+@@ -2269,6 +2573,11 @@
for (int i = 0; i < this.players.size(); ++i) {
EntityHuman entityhuman1 = (EntityHuman) this.players.get(i);
@@ -610,7 +624,7 @@
if (predicate.apply(entityhuman1)) {
double d5 = entityhuman1.d(d0, d1, d2);
-@@ -2437,6 +2739,16 @@
+@@ -2437,6 +2746,16 @@
public void everyoneSleeping() {}
@@ -627,7 +641,7 @@
public float h(float f) {
return (this.p + (this.q - this.p) * f) * this.j(f);
}
-@@ -2654,7 +2966,7 @@
+@@ -2654,7 +2973,7 @@
int l = j * 16 + 8 - blockposition.getZ();
boolean flag = true;