Allow loading entities current chunk if needed to fix collision checks

Having trouble reproducing this myself, but this should do it.
This commit is contained in:
Aikar 2020-05-10 01:04:45 -04:00
parent e5f6489602
commit b4003ef1ca
No known key found for this signature in database
GPG Key ID: 401ADFC9891FAAFE
2 changed files with 5 additions and 5 deletions

View File

@ -14,7 +14,7 @@ movement will load only the chunk the player enters anyways and avoids loading
massive amounts of surrounding chunks due to large AABB lookups.
diff --git a/src/main/java/net/minecraft/server/ICollisionAccess.java b/src/main/java/net/minecraft/server/ICollisionAccess.java
index f851ed11df14fd9aa8017f44d82fb6cfc3bde345..bdebbaf0b93ae7186b0afb3b2c04fdcf11148121 100644
index f851ed11df14fd9aa8017f44d82fb6cfc3bde345..ab88a4f6526f3bae324b53d47581faf384a65ede 100644
--- a/src/main/java/net/minecraft/server/ICollisionAccess.java
+++ b/src/main/java/net/minecraft/server/ICollisionAccess.java
@@ -83,19 +83,29 @@ public interface ICollisionAccess extends IBlockAccess {
@ -40,10 +40,10 @@ index f851ed11df14fd9aa8017f44d82fb6cfc3bde345..bdebbaf0b93ae7186b0afb3b2c04fdcf
+ // 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)));

View File

@ -21,7 +21,7 @@ index e865a5694f78fb9273a0625ab2c30b87d0711a90..5648ba73c533f622c35c808decdb305f
default Stream<VoxelShape> b(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Set<Entity> set) {
return IEntityAccess.super.b(entity, axisalignedbb, set);
diff --git a/src/main/java/net/minecraft/server/ICollisionAccess.java b/src/main/java/net/minecraft/server/ICollisionAccess.java
index be4e311eadbd5a3b4d17ec6eb691d3ff0af711ae..434d8fd019b63e7352c435fe72cdfc32e338e8c5 100644
index 7d9a742224e1694c3d7f1c8dd218598adf6f2767..4fb02328862018e1df12824db5b450333d482b1c 100644
--- a/src/main/java/net/minecraft/server/ICollisionAccess.java
+++ b/src/main/java/net/minecraft/server/ICollisionAccess.java
@@ -43,18 +43,39 @@ public interface ICollisionAccess extends IBlockAccess {
@ -95,7 +95,7 @@ index be4e311eadbd5a3b4d17ec6eb691d3ff0af711ae..434d8fd019b63e7352c435fe72cdfc32
}
@@ -98,9 +119,8 @@ 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)));