1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-02-16 18:31:53 +01:00

Ensure we load chunks for Entity getCubes

Was some other code paths missing the set for loading chunks

Fixes 
Fixes 

Probably helps with "falling through world" issues too.
This commit is contained in:
Aikar 2020-06-20 05:22:09 -04:00
parent 5b7c4a0281
commit 93655fce88
2 changed files with 7 additions and 10 deletions

View file

@ -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<Entity> 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<Entity> set) {
default Stream<VoxelShape> b(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Set<Entity> set) {
@@ -0,0 +0,0 @@ public interface ICollisionAccess extends IBlockAccess {
}

View file

@ -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<Entity> 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<VoxelShape> 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<VoxelShape> getEntityCollisions(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Set<Entity> set, boolean returnFast) { return java.util.Collections.emptyList(); } // Paper