Fix empty voxel shape usage (Fixes #7043)

This commit is contained in:
DefineOutside 2021-12-15 18:15:04 +00:00 committed by Shane Freeder
parent 95d881f916
commit 5ad1d9a01d
No known key found for this signature in database
GPG key ID: A3F61EA5A085289C

View file

@ -955,7 +955,7 @@ index 25b787d1b22e495fb6756e4ee909776ed8699492..042be2cf60a9d01698808d84f2e537a5
} }
// CraftBukkit start // CraftBukkit start
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 516015eb48900abaf0e2f47de4ffd10e9cf4d9a7..821c34a48127802947e293c4599e0cdaea3c040e 100644 index e2c35ace138d7a6c41e7f07e9759f684b7152b71..9bb44918af119d9afae4a0a050c6a5381f028364 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1076,9 +1076,44 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i @@ -1076,9 +1076,44 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
@ -1443,7 +1443,7 @@ index cdb785619b4fce3cb7f0b4a996a15fa43de5f4d1..6db47035fe940ef1f78a14cae6103e22
+ +
} }
diff --git a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java diff --git a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java
index 9176735c08a75854209f24113b0e78332249dc4d..7213acf7ac083e37888eeba28f740c31f1fa0d34 100644 index 9176735c08a75854209f24113b0e78332249dc4d..731c7dd15f131dc124be6af8f342b122cb89491b 100644
--- a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java --- a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java
+++ b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java +++ b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java
@@ -19,16 +19,17 @@ public final class Shapes { @@ -19,16 +19,17 @@ public final class Shapes {
@ -1466,11 +1466,10 @@ index 9176735c08a75854209f24113b0e78332249dc4d..7213acf7ac083e37888eeba28f740c31
} }
public static VoxelShape box(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) { public static VoxelShape box(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) {
@@ -40,30 +41,11 @@ public final class Shapes { @@ -41,29 +42,14 @@ public final class Shapes {
}
public static VoxelShape create(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) { public static VoxelShape create(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) {
- if (!(maxX - minX < 1.0E-7D) && !(maxY - minY < 1.0E-7D) && !(maxZ - minZ < 1.0E-7D)) { if (!(maxX - minX < 1.0E-7D) && !(maxY - minY < 1.0E-7D) && !(maxZ - minZ < 1.0E-7D)) {
- int i = findBits(minX, maxX); - int i = findBits(minX, maxX);
- int j = findBits(minY, maxY); - int j = findBits(minY, maxY);
- int k = findBits(minZ, maxZ); - int k = findBits(minZ, maxZ);
@ -1487,10 +1486,10 @@ index 9176735c08a75854209f24113b0e78332249dc4d..7213acf7ac083e37888eeba28f740c31
- } else { - } else {
- return new ArrayVoxelShape(BLOCK.shape, (DoubleList)DoubleArrayList.wrap(new double[]{minX, maxX}), (DoubleList)DoubleArrayList.wrap(new double[]{minY, maxY}), (DoubleList)DoubleArrayList.wrap(new double[]{minZ, maxZ})); - return new ArrayVoxelShape(BLOCK.shape, (DoubleList)DoubleArrayList.wrap(new double[]{minX, maxX}), (DoubleList)DoubleArrayList.wrap(new double[]{minY, maxY}), (DoubleList)DoubleArrayList.wrap(new double[]{minZ, maxZ}));
- } - }
- } else { + return new io.papermc.paper.voxel.AABBVoxelShape(new AABB(minX, minY, minZ, maxX, maxY, maxZ)); // Paper
- return empty(); } else {
- } return empty();
+ return new io.papermc.paper.voxel.AABBVoxelShape(new AABB(minX, minY, minZ, maxX, maxY, maxZ)); // Paper }
} }
public static VoxelShape create(AABB box) { public static VoxelShape create(AABB box) {
@ -1499,7 +1498,7 @@ index 9176735c08a75854209f24113b0e78332249dc4d..7213acf7ac083e37888eeba28f740c31
} }
@VisibleForTesting @VisibleForTesting
@@ -125,6 +107,20 @@ public final class Shapes { @@ -125,6 +111,20 @@ public final class Shapes {
} }
public static boolean joinIsNotEmpty(VoxelShape shape1, VoxelShape shape2, BooleanOp predicate) { public static boolean joinIsNotEmpty(VoxelShape shape1, VoxelShape shape2, BooleanOp predicate) {
@ -1520,7 +1519,7 @@ index 9176735c08a75854209f24113b0e78332249dc4d..7213acf7ac083e37888eeba28f740c31
if (predicate.apply(false, false)) { if (predicate.apply(false, false)) {
throw (IllegalArgumentException)Util.pauseInIde(new IllegalArgumentException()); throw (IllegalArgumentException)Util.pauseInIde(new IllegalArgumentException());
} else { } else {
@@ -196,6 +192,43 @@ public final class Shapes { @@ -196,6 +196,43 @@ public final class Shapes {
} }
public static VoxelShape getFaceShape(VoxelShape shape, Direction direction) { public static VoxelShape getFaceShape(VoxelShape shape, Direction direction) {
@ -1564,7 +1563,7 @@ index 9176735c08a75854209f24113b0e78332249dc4d..7213acf7ac083e37888eeba28f740c31
if (shape == block()) { if (shape == block()) {
return block(); return block();
} else { } else {
@@ -210,7 +243,7 @@ public final class Shapes { @@ -210,7 +247,7 @@ public final class Shapes {
i = 0; i = 0;
} }
@ -1573,7 +1572,7 @@ index 9176735c08a75854209f24113b0e78332249dc4d..7213acf7ac083e37888eeba28f740c31
} }
} }
@@ -235,6 +268,53 @@ public final class Shapes { @@ -235,6 +272,53 @@ public final class Shapes {
} }
public static boolean faceShapeOccludes(VoxelShape one, VoxelShape two) { public static boolean faceShapeOccludes(VoxelShape one, VoxelShape two) {