Make sure aabbs don't contain already

This commit is contained in:
Ivan Pekov 2020-10-30 09:32:12 +02:00
parent 76d8a3a029
commit 94afff957c
No known key found for this signature in database
GPG Key ID: BC975C392D9CA3A3
2 changed files with 39 additions and 4 deletions

View File

@ -1091,8 +1091,21 @@ index 1f7a8694f69345288c53df0f3a1845f2721f6c7b..841dd0cbd771d878d53292adbd590a1e
}).orElse(0), optional1.map((chunk) -> {
return chunk.getTileEntities().size();
}).orElse(0));
diff --git a/src/main/java/net/minecraft/server/VoxelShape.java b/src/main/java/net/minecraft/server/VoxelShape.java
index 700660dd93b3090334bb3033d5f5fdd6ab684744..98f9ded42264cb88cff701a85d22d99e203ef7cf 100644
--- a/src/main/java/net/minecraft/server/VoxelShape.java
+++ b/src/main/java/net/minecraft/server/VoxelShape.java
@@ -78,7 +78,7 @@ public abstract class VoxelShape {
public final List<AxisAlignedBB> getBoundingBoxesRepresentation() { return this.d(); } // Tuinity - OBFHELPER
public List<AxisAlignedBB> d() {
- List<AxisAlignedBB> list = Lists.newArrayList();
+ List<AxisAlignedBB> list = new net.yatopia.server.list.GlueList<>(); // Yatopia
this.b((d0, d1, d2, d3, d4, d5) -> {
list.add(new AxisAlignedBB(d0, d1, d2, d3, d4, d5));
diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java
index 4bdadffee07c54f6f538ba09db72d562d05cb337..eb358d4453fce1de7f15f38b32e594fa63e4deb5 100644
index 4bdadffee07c54f6f538ba09db72d562d05cb337..8091ec2edc3336f50034960ff7dc24cfeaf308e7 100644
--- a/src/main/java/net/minecraft/server/VoxelShapes.java
+++ b/src/main/java/net/minecraft/server/VoxelShapes.java
@@ -40,7 +40,9 @@ public final class VoxelShapes {
@ -1105,6 +1118,28 @@ index 4bdadffee07c54f6f538ba09db72d562d05cb337..eb358d4453fce1de7f15f38b32e594fa
}
} else if (shape instanceof VoxelShapeArray) {
VoxelShapeArray shapeCasted = (VoxelShapeArray)shape;
@@ -54,14 +56,19 @@ public final class VoxelShapes {
double minX, minY, minZ, maxX, maxY, maxZ;
if (aabb.voxelShapeIntersect(minX = boundingBox.minX + offX, minY = boundingBox.minY + offY, minZ = boundingBox.minZ + offZ,
maxX = boundingBox.maxX + offX, maxY = boundingBox.maxY + offY, maxZ = boundingBox.maxZ + offZ)) {
- list.add(new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ, false));
+ // Yatopia start - make sure it doesn't contain already
+ AxisAlignedBB addedBox = new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ, false);
+ if (!list.contains(addedBox)) {
+ list.add(addedBox);
+ }
+ // Yatopia end
}
}
} else {
java.util.List<AxisAlignedBB> boxes = shape.getBoundingBoxesRepresentation();
for (int i = 0, len = boxes.size(); i < len; ++i) {
AxisAlignedBB box = boxes.get(i);
- if (box.voxelShapeIntersect(aabb)) {
+ if (box.voxelShapeIntersect(aabb) && !list.contains(box)) { // Yatopia - make sure it doesn't contain already
list.add(box);
}
}
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 57b1152cdedce9a2c566ca59dfbf52a20bbabe70..1c9368951044fe92a284bd94a743178613100028 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java

View File

@ -21,7 +21,7 @@ index 92ab79532d29341e8840341ff5ee8f5203cb4aad..bc7b9d0b4d9e3f7519bb013054eeec51
public abstract EnumAxisCycle a();
diff --git a/src/main/java/net/minecraft/server/VoxelShape.java b/src/main/java/net/minecraft/server/VoxelShape.java
index 700660dd93b3090334bb3033d5f5fdd6ab684744..fd34dffa63995c1fc277eac28eb1cd23e3a5e105 100644
index 98f9ded42264cb88cff701a85d22d99e203ef7cf..b94f08dcc911cd632a9c4fb93dcbc4d47aceca94 100644
--- a/src/main/java/net/minecraft/server/VoxelShape.java
+++ b/src/main/java/net/minecraft/server/VoxelShape.java
@@ -148,6 +148,7 @@ public abstract class VoxelShape {
@ -33,10 +33,10 @@ index 700660dd93b3090334bb3033d5f5fdd6ab684744..fd34dffa63995c1fc277eac28eb1cd23
return this.a(EnumAxisCycle.a(enumdirection_enumaxis, EnumDirection.EnumAxis.X), axisalignedbb, d0);
}
diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java
index eb358d4453fce1de7f15f38b32e594fa63e4deb5..88f309073bc4aa6fe0e5421b1d85977aebf5fbb1 100644
index 8091ec2edc3336f50034960ff7dc24cfeaf308e7..fdaffb5faa81282577beb6b73f302d9789ce2431 100644
--- a/src/main/java/net/minecraft/server/VoxelShapes.java
+++ b/src/main/java/net/minecraft/server/VoxelShapes.java
@@ -274,6 +274,21 @@ public final class VoxelShapes {
@@ -279,6 +279,21 @@ public final class VoxelShapes {
return 0.0D;
} else {
EnumAxisCycle enumaxiscycle1 = enumaxiscycle.a();