From 93655fce88aa38cad50c47aab4f0609e50e8aeb2 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 20 Jun 2020 05:22:09 -0400 Subject: [PATCH] Ensure we load chunks for Entity getCubes Was some other code paths missing the set for loading chunks Fixes #3582 Fixes #3368 Probably helps with "falling through world" issues too. --- .../Optimize-Collision-to-not-load-chunks.patch | 14 +++++--------- ...ve-some-Streams-usage-in-Entity-Collision.patch | 3 ++- 2 files changed, 7 insertions(+), 10 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 9279a5295a..2cd9d1192c 100644 --- a/Spigot-Server-Patches/Optimize-Collision-to-not-load-chunks.patch +++ b/Spigot-Server-Patches/Optimize-Collision-to-not-load-chunks.patch @@ -32,17 +32,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public interface ICollisionAccess extends IBlockAccess { } - default boolean getCubes(Entity entity, AxisAlignedBB axisalignedbb) { -- return this.a(entity, axisalignedbb, Collections.emptySet()); -+ // Paper start - load chunks for getCubes -+ entity.collisionLoadChunks = true; -+ boolean result = this.a(entity, axisalignedbb, Collections.emptySet()); -+ entity.collisionLoadChunks = false; -+ return result; -+ // Paper end + default boolean a(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Set set) { ++ try { if (entity != null) entity.collisionLoadChunks = true; // Paper + return this.c(entity, axisalignedbb, set).allMatch(VoxelShape::isEmpty); ++ } finally { if (entity != null) entity.collisionLoadChunks = false; } // Paper } - default boolean a(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Set set) { + default Stream b(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Set set) { @@ -0,0 +0,0 @@ public interface ICollisionAccess extends IBlockAccess { } 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 4fa1ae1a9f..0576b73640 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 @@ -25,9 +25,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/ICollisionAccess.java +++ b/src/main/java/net/minecraft/server/ICollisionAccess.java @@ -0,0 +0,0 @@ public interface ICollisionAccess extends IBlockAccess { - } default boolean a(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Set set) { + try { if (entity != null) entity.collisionLoadChunks = true; // Paper - return this.c(entity, axisalignedbb, set).allMatch(VoxelShape::isEmpty); + // Paper start - reduce stream usage + java.util.List blockCollisions = getBlockCollision(entity, axisalignedbb, true); @@ -39,6 +39,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + return getEntityCollisions(entity, axisalignedbb, set, true).isEmpty(); + // Paper end + } finally { if (entity != null) entity.collisionLoadChunks = false; } // Paper } + default java.util.List getEntityCollisions(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Set set, boolean returnFast) { return java.util.Collections.emptyList(); } // Paper