From 5eea746c7894f37d1dc9131dfe48885d4451c355 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 10 May 2020 01:04:45 -0400 Subject: [PATCH] Allow loading entities current chunk if needed to fix collision checks Having trouble reproducing this myself, but this should do it. --- .../Optimize-Collision-to-not-load-chunks.patch | 4 ++-- .../Remove-some-Streams-usage-in-Entity-Collision.patch | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Spigot-Server-Patches/Optimize-Collision-to-not-load-chunks.patch b/Spigot-Server-Patches/Optimize-Collision-to-not-load-chunks.patch index b569f3549..f7f280ed3 100644 --- a/Spigot-Server-Patches/Optimize-Collision-to-not-load-chunks.patch +++ b/Spigot-Server-Patches/Optimize-Collision-to-not-load-chunks.patch @@ -40,10 +40,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - ensure we don't load chunks + //int k2 = k1 >> 4; + //int l2 = i2 >> 4; -+ boolean far = entity != null && MCUtil.distance(entity.locX(), entity.locY(), entity.locZ(), x, y, z) > 1; ++ boolean far = entity != null && MCUtil.distance(entity.locX(), entity.locY(), entity.locZ(), x, y, z) > 8; + blockposition_mutableblockposition.setValues(x, y, z); // Paper - moved up + -+ IBlockData iblockdata = ICollisionAccess.this.getTypeIfLoaded(blockposition_mutableblockposition); ++ IBlockData iblockdata = !far ? ICollisionAccess.this.getType(blockposition_mutableblockposition) : ICollisionAccess.this.getTypeIfLoaded(blockposition_mutableblockposition); + if (iblockdata == null) { + if (!(entity instanceof EntityPlayer) || entity.world.paperConfig.preventMovingIntoUnloadedChunks) { + VoxelShape voxelshape3 = VoxelShapes.of(far ? entity.getBoundingBox() : new AxisAlignedBB(new BlockPosition(x, y, z))); diff --git a/Spigot-Server-Patches/Remove-some-Streams-usage-in-Entity-Collision.patch b/Spigot-Server-Patches/Remove-some-Streams-usage-in-Entity-Collision.patch index 30f5ed959..193f54746 100644 --- a/Spigot-Server-Patches/Remove-some-Streams-usage-in-Entity-Collision.patch +++ b/Spigot-Server-Patches/Remove-some-Streams-usage-in-Entity-Collision.patch @@ -95,7 +95,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } @@ -0,0 +0,0 @@ public interface ICollisionAccess extends IBlockAccess { - IBlockData iblockdata = ICollisionAccess.this.getTypeIfLoaded(blockposition_mutableblockposition); + IBlockData iblockdata = !far ? ICollisionAccess.this.getType(blockposition_mutableblockposition) : ICollisionAccess.this.getTypeIfLoaded(blockposition_mutableblockposition); if (iblockdata == null) { if (!(entity instanceof EntityPlayer) || entity.world.paperConfig.preventMovingIntoUnloadedChunks) { - VoxelShape voxelshape3 = VoxelShapes.of(far ? entity.getBoundingBox() : new AxisAlignedBB(new BlockPosition(x, y, z)));