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 6a2d838268..7d651a904d 100644 --- a/Spigot-Server-Patches/Optimize-Collision-to-not-load-chunks.patch +++ b/Spigot-Server-Patches/Optimize-Collision-to-not-load-chunks.patch @@ -30,25 +30,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 int j2 = cursorposition.e(); if (j2 != 3) { -+ // Paper start - ensure we don't load chunks - int k2 = k1 >> 4; - int l2 = i2 >> 4; +- int k2 = k1 >> 4; +- int l2 = i2 >> 4; - IBlockAccess iblockaccess = ICollisionAccess.this.c(k2, l2); - - if (iblockaccess != null) { - blockposition_mutableblockposition.d(k1, l1, i2); - IBlockData iblockdata = iblockaccess.getType(blockposition_mutableblockposition); -+ boolean far = entity != null && MCUtil.distance(entity.locX(), entity.locY(), entity.locZ(), x, y, z) > 8; ++ // Paper start - ensure we don't load chunks ++ //int k2 = k1 >> 4; ++ //int l2 = i2 >> 4; ++ boolean far = entity != null && MCUtil.distanceSq(entity.locX(), y, entity.locZ(), x, y, z) > 8; + blockposition_mutableblockposition.setValues(x, y, z); + + boolean isRegionLimited = ICollisionAccess.this instanceof RegionLimitedWorldAccess; -+ IBlockData iblockdata = !isRegionLimited ? ICollisionAccess.this.getTypeIfLoaded(blockposition_mutableblockposition) : null; -+ if ((isRegionLimited || !far) && iblockdata == null) { -+ IBlockAccess c = ICollisionAccess.this.c(k2, l2); -+ if (c != null) { -+ iblockdata = c.getType(blockposition_mutableblockposition); -+ } -+ } ++ IBlockData iblockdata = isRegionLimited ? Blocks.VOID_AIR.getBlockData() : (!far && entity instanceof EntityPlayer ++ ? 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 990346a998..4fa1ae1a9f 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 { - } + ); 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)));