Don't use our modified chunk checks for collision in world gen

Fixes issues with errors in logs on generating chunks
This commit is contained in:
Aikar 2020-05-10 02:26:21 -04:00
parent b4003ef1ca
commit cd93e54df3
No known key found for this signature in database
GPG key ID: 401ADFC9891FAAFE
3 changed files with 21 additions and 16 deletions

View file

@ -14,10 +14,10 @@ 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..ab88a4f6526f3bae324b53d47581faf384a65ede 100644
index f851ed11df14fd9aa8017f44d82fb6cfc3bde345..f817aaf17bee97e5023a1373bb774d94e7073be7 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 {
@@ -83,19 +83,36 @@ public interface ICollisionAccess extends IBlockAccess {
}
while (cursorposition.a()) {
@ -30,20 +30,25 @@ index f851ed11df14fd9aa8017f44d82fb6cfc3bde345..ab88a4f6526f3bae324b53d47581faf3
int j2 = cursorposition.e();
if (j2 != 3) {
- int k2 = k1 >> 4;
- int l2 = i2 >> 4;
+ // Paper start - ensure we don't load chunks
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);
+ // 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) > 8;
+ blockposition_mutableblockposition.setValues(x, y, z); // Paper - moved up
+ blockposition_mutableblockposition.setValues(x, y, z);
+
+ IBlockData iblockdata = !far ? ICollisionAccess.this.getType(blockposition_mutableblockposition) : ICollisionAccess.this.getTypeIfLoaded(blockposition_mutableblockposition);
+ 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);
+ }
+ }
+ 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

@ -9,10 +9,10 @@ Original code by JellySquid, licensed under GNU Lesser General Public License v3
you can find the original code on https://github.com/jellysquid3/lithium-fabric/tree/1.15.x/fabric (Yarn mappings)
diff --git a/src/main/java/net/minecraft/server/ICollisionAccess.java b/src/main/java/net/minecraft/server/ICollisionAccess.java
index bdebbaf0b93ae7186b0afb3b2c04fdcf11148121..be4e311eadbd5a3b4d17ec6eb691d3ff0af711ae 100644
index f817aaf17bee97e5023a1373bb774d94e7073be7..5baae144c598ce6d1c12c292db01d9b25520653e 100644
--- a/src/main/java/net/minecraft/server/ICollisionAccess.java
+++ b/src/main/java/net/minecraft/server/ICollisionAccess.java
@@ -109,11 +109,24 @@ public interface ICollisionAccess extends IBlockAccess {
@@ -116,11 +116,24 @@ public interface ICollisionAccess extends IBlockAccess {
if ((j2 != 1 || iblockdata.f()) && (j2 != 2 || iblockdata.getBlock() == Blocks.MOVING_PISTON)) {
VoxelShape voxelshape2 = iblockdata.b((IBlockAccess) ICollisionAccess.this, blockposition_mutableblockposition, voxelshapecollision);

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 7d9a742224e1694c3d7f1c8dd218598adf6f2767..4fb02328862018e1df12824db5b450333d482b1c 100644
index 5baae144c598ce6d1c12c292db01d9b25520653e..ab242a82493a78a89bbc0ab9113d10fd61864c02 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 {
@ -94,8 +94,8 @@ index 7d9a742224e1694c3d7f1c8dd218598adf6f2767..4fb02328862018e1df12824db5b45033
}
}
@@ -98,9 +119,8 @@ public interface ICollisionAccess extends IBlockAccess {
IBlockData iblockdata = !far ? ICollisionAccess.this.getType(blockposition_mutableblockposition) : ICollisionAccess.this.getTypeIfLoaded(blockposition_mutableblockposition);
@@ -105,9 +126,8 @@ 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)));
@ -106,7 +106,7 @@ index 7d9a742224e1694c3d7f1c8dd218598adf6f2767..4fb02328862018e1df12824db5b45033
}
} else {
//blockposition_mutableblockposition.d(k1, l1, i2); // moved up
@@ -117,14 +137,14 @@ public interface ICollisionAccess extends IBlockAccess {
@@ -124,14 +144,14 @@ public interface ICollisionAccess extends IBlockAccess {
if (voxelshape2 == VoxelShapes.fullCube()) {
if (axisalignedbb.intersects(x, y, z, x + 1.0D, y + 1.0D, z + 1.0D)) {
@ -125,7 +125,7 @@ index 7d9a742224e1694c3d7f1c8dd218598adf6f2767..4fb02328862018e1df12824db5b45033
}
// Paper end
}
@@ -133,8 +153,9 @@ public interface ICollisionAccess extends IBlockAccess {
@@ -140,8 +160,9 @@ public interface ICollisionAccess extends IBlockAccess {
}
}