diff --git a/sources/src/main/java/net/minecraft/server/Chunk.java b/sources/src/main/java/net/minecraft/server/Chunk.java index 01a07eac5..b32c09ba2 100644 --- a/sources/src/main/java/net/minecraft/server/Chunk.java +++ b/sources/src/main/java/net/minecraft/server/Chunk.java @@ -982,6 +982,8 @@ public class Chunk { } } // Spigot End + entity.setCurrentChunk(null); // Paper + entity.entitySlice = null; // Paper // Do not pass along players, as doing so can get them stuck outside of time. // (which for example disables inventory icon updates and prevents block breaking) diff --git a/sources/src/main/java/net/minecraft/server/Entity.java b/sources/src/main/java/net/minecraft/server/Entity.java index 4258832f9..10dd3cd89 100644 --- a/sources/src/main/java/net/minecraft/server/Entity.java +++ b/sources/src/main/java/net/minecraft/server/Entity.java @@ -85,7 +85,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper private static final List b = Collections.emptyList(); private static final AxisAlignedBB c = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); private static double f = 1.0D; - private static int entityCount; + private static int entityCount = 1; // Paper - MC-111480 - ID 0 is treated as special for DataWatchers, start 1 private int id; public boolean i; public boolean blocksEntitySpawning() { return i; } // Paper - OBFHELPER public final List passengers; @@ -345,6 +345,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper this.locX = d0; this.locY = d1; this.locZ = d2; + if (valid) world.entityJoinedWorld(this, false); // Paper - ensure Entity is moved to its proper chunk float f = this.width / 2.0F; float f1 = this.length; @@ -990,6 +991,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper this.locX = (axisalignedbb.a + axisalignedbb.d) / 2.0D; this.locY = axisalignedbb.b; this.locZ = (axisalignedbb.c + axisalignedbb.f) / 2.0D; + if (valid) world.entityJoinedWorld(this, false); // Paper - ensure Entity is moved to its proper chunk } protected SoundEffect ae() { @@ -1792,7 +1794,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper */ public Chunk getCurrentChunk() { final Chunk chunk = currentChunk != null ? currentChunk.get() : null; - return chunk != null && chunk.isLoaded() ? chunk : null; + return chunk != null && chunk.isLoaded() ? chunk : (isAddedToChunk() ? world.getChunkIfLoaded(getChunkX(), getChunkZ()) : null); } /** * Returns the chunk at the location, using the entities local cache if avail diff --git a/sources/src/main/java/net/minecraft/server/World.java b/sources/src/main/java/net/minecraft/server/World.java index b2d282b86..54c2ce191 100644 --- a/sources/src/main/java/net/minecraft/server/World.java +++ b/sources/src/main/java/net/minecraft/server/World.java @@ -1960,7 +1960,7 @@ public abstract class World implements IBlockAccess { this.getChunkAt(entity.ab, entity.ad).a(entity, entity.ac); } - if (!entity.bD() && !this.isChunkLoaded(i, k, true)) { + if (false && !entity.bD() && !this.isChunkLoaded(i, k, true)) { // Paper - Always send entities into a new chunk, never lose them entity.aa = false; } else { this.getChunkAt(i, k).a(entity); diff --git a/work/Paper b/work/Paper index a0d9a21d0..cfb71ab96 160000 --- a/work/Paper +++ b/work/Paper @@ -1 +1 @@ -Subproject commit a0d9a21d0498b55d935cf3d3f84f5d84e3e0cae6 +Subproject commit cfb71ab9668944593ce618f7dbb0ee3aa0356030