Re-introduce entity-in-wrong-chunk-at-unload workaround (fixes #548)

Nope, this was not fixed, they just changed where the chunkCoords are stored but
the interpolation issue remains.
This commit is contained in:
Jonas Herzig
2021-07-24 17:06:46 +02:00
parent 35fef5176d
commit 0cb14a9106

View File

@@ -1163,9 +1163,6 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
// 1.14+: The update issue remains but only for non-players and the unloading list bug appears to have been // 1.14+: The update issue remains but only for non-players and the unloading list bug appears to have been
// fixed (chunk unloading no longer removes the entities). // fixed (chunk unloading no longer removes the entities).
// Get the chunk that will be unloaded // Get the chunk that will be unloaded
//#if MC>=11700
//$$ // From the looks of it, this may be fixed now (thanks to EntityChangeListener), guess we'll see
//#else
//#if MC>=11400 //#if MC>=11400
ClientWorld world = mc.world; ClientWorld world = mc.world;
ChunkManager chunkProvider = world.getChunkManager(); ChunkManager chunkProvider = world.getChunkManager();
@@ -1183,9 +1180,17 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
//#endif //#endif
List<Entity> entitiesInChunk = new ArrayList<>(); List<Entity> entitiesInChunk = new ArrayList<>();
// Gather all entities in that chunk // Gather all entities in that chunk
//#if MC>=11700
//$$ for (Entity entity : mc.world.getEntities()) {
//$$ if (entity.getChunkPos().equals(chunk.getPos())) {
//$$ entitiesInChunk.add(entity);
//$$ }
//$$ }
//#else
for (Collection<Entity> entityList : chunk.getEntitySectionArray()) { for (Collection<Entity> entityList : chunk.getEntitySectionArray()) {
entitiesInChunk.addAll(entityList); entitiesInChunk.addAll(entityList);
} }
//#endif
for (Entity entity : entitiesInChunk) { for (Entity entity : entitiesInChunk) {
// Skip interpolation of position updates coming from server // Skip interpolation of position updates coming from server
// (See: newX in EntityLivingBase or otherPlayerMPX in EntityOtherPlayerMP) // (See: newX in EntityLivingBase or otherPlayerMPX in EntityOtherPlayerMP)
@@ -1200,7 +1205,9 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
} }
// Check whether the entity has left the chunk // Check whether the entity has left the chunk
//#if MC>=11404 //#if MC>=11700
//$$ // This is now handled automatically in Entity.setPos (called from tick())
//#elseif MC>=11404
int chunkX = MathHelper.floor(entity.getX() / 16); int chunkX = MathHelper.floor(entity.getX() / 16);
int chunkY = MathHelper.floor(entity.getY() / 16); int chunkY = MathHelper.floor(entity.getY() / 16);
int chunkZ = MathHelper.floor(entity.getZ() / 16); int chunkZ = MathHelper.floor(entity.getZ() / 16);
@@ -1262,7 +1269,6 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
//#endif //#endif
} }
} }
//#endif
} }
return p; // During synchronous playback everything is sent normally return p; // During synchronous playback everything is sent normally
} }