Process entity portalling towards the end of a tick.

Cross world teleportation works by taking a copy of an entity and moving it to a new world. After this happens the original entity is marked as dead so as to be removed from the original world, however it still undergoes one further tick in the main world, but with some information from the new world. It is not so easy to break out of this tick cycle if needed, so instead we move the portalling process towards the end of an existing tick. This ensures that the entity will not be spuriously ticked.

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2017-03-20 15:41:15 +11:00
parent 3d517d9d80
commit b18c5c741b
2 changed files with 115 additions and 40 deletions

View File

@@ -460,7 +460,15 @@
entity.M = entity.locX;
entity.N = entity.locY;
entity.O = entity.locZ;
@@ -1547,11 +1799,18 @@
@@ -1255,6 +1507,7 @@
entity.aw();
} else {
entity.A_();
+ entity.postTick(); // CraftBukkit
}
}
@@ -1547,11 +1800,18 @@
}
}
@@ -479,7 +487,7 @@
TileEntity tileentity = null;
if (this.M) {
@@ -1586,6 +1845,14 @@
@@ -1586,6 +1846,14 @@
public void setTileEntity(BlockPosition blockposition, @Nullable TileEntity tileentity) {
if (!this.E(blockposition)) {
if (tileentity != null && !tileentity.y()) {
@@ -494,7 +502,7 @@
if (this.M) {
tileentity.setPosition(blockposition);
Iterator iterator = this.b.iterator();
@@ -1745,6 +2012,14 @@
@@ -1745,6 +2013,14 @@
}
this.o = MathHelper.a(this.o, 0.0F, 1.0F);
@@ -509,7 +517,7 @@
}
}
}
@@ -1876,7 +2151,10 @@
@@ -1876,7 +2152,10 @@
}
public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition) {
@@ -521,7 +529,7 @@
return false;
} else {
int i = 0;
@@ -2043,7 +2321,7 @@
@@ -2043,7 +2322,7 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@@ -530,7 +538,7 @@
arraylist.add(entity);
}
}
@@ -2058,7 +2336,7 @@
@@ -2058,7 +2337,7 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@@ -539,7 +547,7 @@
arraylist.add(entity);
}
}
@@ -2107,7 +2385,7 @@
@@ -2107,7 +2386,7 @@
}
}
@@ -548,7 +556,7 @@
}
@Nullable
@@ -2128,8 +2406,17 @@
@@ -2128,8 +2407,17 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@@ -568,7 +576,7 @@
++i;
}
}
@@ -2138,12 +2425,18 @@
@@ -2138,12 +2426,18 @@
}
public void a(Collection<Entity> collection) {
@@ -588,7 +596,7 @@
this.b(entity);
}
@@ -2157,7 +2450,13 @@
@@ -2157,7 +2451,13 @@
IBlockData iblockdata = this.getType(blockposition);
AxisAlignedBB axisalignedbb = flag ? null : block.getBlockData().c(this, blockposition);
@@ -603,7 +611,7 @@
}
public int K() {
@@ -2267,6 +2566,11 @@
@@ -2267,6 +2567,11 @@
for (int i = 0; i < this.players.size(); ++i) {
EntityHuman entityhuman1 = (EntityHuman) this.players.get(i);
@@ -615,7 +623,7 @@
if (predicate.apply(entityhuman1)) {
double d5 = entityhuman1.d(d0, d1, d2);
@@ -2435,6 +2739,16 @@
@@ -2435,6 +2740,16 @@
public void everyoneSleeping() {}
@@ -632,7 +640,7 @@
public float h(float f) {
return (this.p + (this.q - this.p) * f) * this.j(f);
}
@@ -2652,7 +2966,7 @@
@@ -2652,7 +2967,7 @@
int l = j * 16 + 8 - blockposition.getZ();
boolean flag = true;