Updated Upstream (Tuinity)

Upstream has released updates that appears to apply and compile correctly

Tuinity Changes:
ed9c0c4 Fix worldborder checks for getCubes
This commit is contained in:
BillyGalbreath
2020-11-22 07:21:18 -06:00
parent 3e0a7585a4
commit 058399c195
10 changed files with 95 additions and 67 deletions

View File

@@ -5541,10 +5541,10 @@ index 000000000..002abb3cb
+ }
+}
diff --git a/src/main/java/net/minecraft/server/AxisAlignedBB.java b/src/main/java/net/minecraft/server/AxisAlignedBB.java
index ed9b2f9ad..d759a6c2b 100644
index ed9b2f9ad..9fbb77e70 100644
--- a/src/main/java/net/minecraft/server/AxisAlignedBB.java
+++ b/src/main/java/net/minecraft/server/AxisAlignedBB.java
@@ -13,6 +13,140 @@ public class AxisAlignedBB {
@@ -13,6 +13,149 @@ public class AxisAlignedBB {
public final double maxY;
public final double maxZ;
@@ -5570,7 +5570,9 @@ index ed9b2f9ad..d759a6c2b 100644
+ */
+
+ public final boolean voxelShapeIntersect(AxisAlignedBB other) {
+ return this.voxelShapeIntersect(other.minX, other.minY, other.minZ, other.maxX, other.maxY, other.maxZ);
+ return (this.minX - other.maxX) < -MCUtil.COLLISION_EPSILON && (this.maxX - other.minX) > MCUtil.COLLISION_EPSILON &&
+ (this.minY - other.maxY) < -MCUtil.COLLISION_EPSILON && (this.maxY - other.minY) > MCUtil.COLLISION_EPSILON &&
+ (this.minZ - other.maxZ) < -MCUtil.COLLISION_EPSILON && (this.maxZ - other.minZ) > MCUtil.COLLISION_EPSILON;
+ }
+
+ public final boolean voxelShapeIntersect(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) {
@@ -5579,6 +5581,13 @@ index ed9b2f9ad..d759a6c2b 100644
+ (this.minZ - maxZ) < -MCUtil.COLLISION_EPSILON && (this.maxZ - minZ) > MCUtil.COLLISION_EPSILON;
+ }
+
+ public static boolean voxelShapeIntersect(double minX1, double minY1, double minZ1, double maxX1, double maxY1, double maxZ1,
+ double minX2, double minY2, double minZ2, double maxX2, double maxY2, double maxZ2) {
+ return (minX1 - maxX2) < -MCUtil.COLLISION_EPSILON && (maxX1 - minX2) > MCUtil.COLLISION_EPSILON &&
+ (minY1 - maxY2) < -MCUtil.COLLISION_EPSILON && (maxY1 - minY2) > MCUtil.COLLISION_EPSILON &&
+ (minZ1 - maxZ2) < -MCUtil.COLLISION_EPSILON && (maxZ1 - minZ2) > MCUtil.COLLISION_EPSILON;
+ }
+
+ public static double collideX(AxisAlignedBB target, AxisAlignedBB source, double source_move) {
+ if (Math.abs(source_move) < MCUtil.COLLISION_EPSILON) {
+ return 0.0;
@@ -5685,7 +5694,7 @@ index ed9b2f9ad..d759a6c2b 100644
public AxisAlignedBB(double d0, double d1, double d2, double d3, double d4, double d5) {
this.minX = Math.min(d0, d3);
this.minY = Math.min(d1, d4);
@@ -185,6 +319,7 @@ public class AxisAlignedBB {
@@ -185,6 +328,7 @@ public class AxisAlignedBB {
return new AxisAlignedBB(d0, d1, d2, d3, d4, d5);
}
@@ -5693,7 +5702,7 @@ index ed9b2f9ad..d759a6c2b 100644
public AxisAlignedBB d(double d0, double d1, double d2) {
return new AxisAlignedBB(this.minX + d0, this.minY + d1, this.minZ + d2, this.maxX + d0, this.maxY + d1, this.maxZ + d2);
}
@@ -193,6 +328,7 @@ public class AxisAlignedBB {
@@ -193,6 +337,7 @@ public class AxisAlignedBB {
return new AxisAlignedBB(this.minX + (double) blockposition.getX(), this.minY + (double) blockposition.getY(), this.minZ + (double) blockposition.getZ(), this.maxX + (double) blockposition.getX(), this.maxY + (double) blockposition.getY(), this.maxZ + (double) blockposition.getZ());
}
@@ -5701,7 +5710,7 @@ index ed9b2f9ad..d759a6c2b 100644
public AxisAlignedBB c(Vec3D vec3d) {
return this.d(vec3d.x, vec3d.y, vec3d.z);
}
@@ -212,6 +348,7 @@ public class AxisAlignedBB {
@@ -212,6 +357,7 @@ public class AxisAlignedBB {
return this.e(vec3d.x, vec3d.y, vec3d.z);
}
@@ -6755,7 +6764,7 @@ index dcbae1c45..9d749dea1 100644
int j = MathHelper.floor((axisalignedbb.maxY + 2.0D) / 16.0D);
diff --git a/src/main/java/net/minecraft/server/ChunkCache.java b/src/main/java/net/minecraft/server/ChunkCache.java
index 8eecdcde5..ab8664ef2 100644
index 8eecdcde5..831aaffaa 100644
--- a/src/main/java/net/minecraft/server/ChunkCache.java
+++ b/src/main/java/net/minecraft/server/ChunkCache.java
@@ -1,5 +1,6 @@
@@ -6792,7 +6801,7 @@ index 8eecdcde5..ab8664ef2 100644
+ final boolean checkOnly = true;
+
+ if (entity != null) {
+ if (this.getWorldBorder().isCollidingOnBorderEdge(axisalignedbb)) {
+ if (this.getWorldBorder().isAlmostCollidingOnBorder(axisalignedbb)) {
+ if (checkOnly) {
+ return true;
+ } else {
@@ -7904,7 +7913,7 @@ index 550232cb3..229c3b0f0 100644
throwable = throwable1;
throw throwable1;
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 0c952fea3..152f3cc5b 100644
index 0c952fea3..677188661 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -136,7 +136,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -8058,7 +8067,7 @@ index 0c952fea3..152f3cc5b 100644
}
protected BlockPosition ap() {
@@ -815,6 +893,132 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -815,6 +893,135 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
return d0;
}
@@ -8157,6 +8166,9 @@ index 0c952fea3..152f3cc5b 100644
+ collisionBox = currBoundingBox.expand(moveVector.x, moveVector.y, moveVector.z);
+ }
+ world.getCollisions(this, collisionBox, potentialCollisions, this instanceof EntityPlayer && !this.world.paperConfig.preventMovingIntoUnloadedChunks);
+ if (world.getWorldBorder().isCollidingWithBorderEdge(collisionBox)) {
+ VoxelShapes.addBoxesToIfIntersects(world.getWorldBorder().getCollisionShape(), collisionBox, potentialCollisions);
+ }
+
+ Vec3D limitedMoveVector = Entity.performCollisions(moveVector, currBoundingBox, potentialCollisions);
+
@@ -8191,7 +8203,7 @@ index 0c952fea3..152f3cc5b 100644
private Vec3D g(Vec3D vec3d) {
AxisAlignedBB axisalignedbb = this.getBoundingBox();
VoxelShapeCollision voxelshapecollision = VoxelShapeCollision.a(this);
@@ -850,6 +1054,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -850,6 +1057,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
return vec3d1;
}
@@ -8199,7 +8211,7 @@ index 0c952fea3..152f3cc5b 100644
public static double c(Vec3D vec3d) {
return vec3d.x * vec3d.x + vec3d.z * vec3d.z;
}
@@ -962,18 +1167,34 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -962,18 +1170,34 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
}
protected void checkBlockCollisions() {
@@ -8237,7 +8249,7 @@ index 0c952fea3..152f3cc5b 100644
try {
iblockdata.a(this.world, blockposition_mutableblockposition, this);
this.a(iblockdata);
@@ -987,6 +1208,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -987,6 +1211,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
}
}
}
@@ -8249,7 +8261,7 @@ index 0c952fea3..152f3cc5b 100644
}
}
@@ -1358,6 +1584,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -1358,6 +1587,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
return d3 * d3 + d4 * d4 + d5 * d5;
}
@@ -8257,7 +8269,7 @@ index 0c952fea3..152f3cc5b 100644
public double h(Entity entity) {
return this.e(entity.getPositionVector());
}
@@ -1938,9 +2165,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -1938,9 +2168,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
float f1 = this.size.width * 0.8F;
AxisAlignedBB axisalignedbb = AxisAlignedBB.g((double) f1, 0.10000000149011612D, (double) f1).d(this.locX(), this.getHeadY(), this.locZ());
@@ -8269,7 +8281,7 @@ index 0c952fea3..152f3cc5b 100644
}
}
@@ -1948,11 +2175,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -1948,11 +2178,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
return EnumInteractionResult.PASS;
}
@@ -8285,7 +8297,7 @@ index 0c952fea3..152f3cc5b 100644
return false;
}
@@ -3294,12 +3523,16 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -3294,12 +3526,16 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
return this.locBlock;
}
@@ -8302,7 +8314,7 @@ index 0c952fea3..152f3cc5b 100644
}
public void setMot(double d0, double d1, double d2) {
@@ -3354,7 +3587,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -3354,7 +3590,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
}
// Paper end
if (this.loc.x != d0 || this.loc.y != d1 || this.loc.z != d2) {
@@ -13729,42 +13741,58 @@ index 9ed21f434..59abca0fd 100644
public abstract Entity getEntity(int i);
diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java
index f01186988..26a8c4ffe 100644
index f01186988..0d10d317c 100644
--- a/src/main/java/net/minecraft/server/WorldBorder.java
+++ b/src/main/java/net/minecraft/server/WorldBorder.java
@@ -47,11 +47,43 @@ public class WorldBorder {
@@ -47,11 +47,59 @@ public class WorldBorder {
return axisalignedbb.maxX > this.e() && axisalignedbb.minX < this.g() && axisalignedbb.maxZ > this.f() && axisalignedbb.minZ < this.h();
}
+ // Tuinity start - optimise collisions
+ // determines whether we are colliding with one of the wordborder faces.
+ public final boolean isCollidingOnBorderEdge(AxisAlignedBB boundingBox) {
+ return this.isCollidingOnBorderEdge(boundingBox.minX, boundingBox.maxX, boundingBox.minZ, boundingBox.maxZ);
+ // determines whether we are almost colliding with the world border
+ // for clear collisions, this rets false
+ public final boolean isAlmostCollidingOnBorder(AxisAlignedBB boundingBox) {
+ return this.isAlmostCollidingOnBorder(boundingBox.minX, boundingBox.maxX, boundingBox.minZ, boundingBox.maxZ);
+ }
+
+ public final boolean isCollidingOnBorderEdge(double boxMinX, double boxMaxX, double boxMinZ, double boxMaxZ) {
+ double minX = this.getMinX() - MCUtil.COLLISION_EPSILON;
+ double maxX = this.getMaxX() + MCUtil.COLLISION_EPSILON;
+ public final boolean isAlmostCollidingOnBorder(double boxMinX, double boxMaxX, double boxMinZ, double boxMaxZ) {
+ double borderMinX = this.getMinX();
+ double borderMaxX = this.getMaxX();
+
+ double minZ = this.getMinZ() - MCUtil.COLLISION_EPSILON;
+ double maxZ = this.getMaxZ() + MCUtil.COLLISION_EPSILON;
+ double borderMinZ = this.getMinZ();
+ double borderMaxZ = this.getMaxZ();
+
+ return
+ // First, check if the worldborder is enclosing the specified box.
+ // We check this first as it's most likely to fail.
+ !(minX < boxMinX && maxX > boxMaxX && minZ < boxMinZ && maxZ > boxMaxZ)
+ // Not intersecting if we're smaller
+ !AxisAlignedBB.voxelShapeIntersect(
+ boxMinX + MCUtil.COLLISION_EPSILON, Double.NEGATIVE_INFINITY, boxMinZ + MCUtil.COLLISION_EPSILON,
+ boxMaxX - MCUtil.COLLISION_EPSILON, Double.POSITIVE_INFINITY, boxMaxZ - MCUtil.COLLISION_EPSILON,
+ borderMinX, Double.NEGATIVE_INFINITY, borderMinZ, borderMaxX, Double.POSITIVE_INFINITY, borderMaxZ
+ )
+ &&
+
+ // Now we verify if we're even intersecting.
+ (minX < boxMaxX && maxX > boxMinX && minZ < boxMaxZ && maxZ > boxMinZ)
+ &&
+
+ // Now verify that the worldborder isn't being enclosed.
+ // This is never expected to happen, but is left here to ensure our logic
+ // is right 100% of the time.
+ !(boxMinX < minX && boxMaxX > maxX && boxMinZ < minZ && boxMaxZ > maxZ)
+ // Are intersecting if we're larger
+ AxisAlignedBB.voxelShapeIntersect(
+ boxMinX - MCUtil.COLLISION_EPSILON, Double.NEGATIVE_INFINITY, boxMinZ - MCUtil.COLLISION_EPSILON,
+ boxMaxX + MCUtil.COLLISION_EPSILON, Double.POSITIVE_INFINITY, boxMaxZ + MCUtil.COLLISION_EPSILON,
+ borderMinX, Double.NEGATIVE_INFINITY, borderMinZ, borderMaxX, Double.POSITIVE_INFINITY, borderMaxZ
+ )
+ ;
+ }
+
+ public final boolean isCollidingWithBorderEdge(AxisAlignedBB boundingBox) {
+ return this.isCollidingWithBorderEdge(boundingBox.minX, boundingBox.maxX, boundingBox.minZ, boundingBox.maxZ);
+ }
+
+ public final boolean isCollidingWithBorderEdge(double boxMinX, double boxMaxX, double boxMinZ, double boxMaxZ) {
+ double borderMinX = this.getMinX() + MCUtil.COLLISION_EPSILON;
+ double borderMaxX = this.getMaxX() - MCUtil.COLLISION_EPSILON;
+
+ double borderMinZ = this.getMinZ() + MCUtil.COLLISION_EPSILON;
+ double borderMaxZ = this.getMaxZ() - MCUtil.COLLISION_EPSILON;
+
+ return boxMinX < borderMinX || boxMaxX > borderMaxX || boxMinZ < borderMinZ || boxMaxZ > borderMaxZ;
+ }
+ // Tuinity end - optimise collisions
+
public double a(Entity entity) {
@@ -13776,7 +13804,7 @@ index f01186988..26a8c4ffe 100644
public VoxelShape c() {
return this.j.m();
}
@@ -67,18 +99,22 @@ public class WorldBorder {
@@ -67,18 +115,22 @@ public class WorldBorder {
return Math.min(d6, d3);
}
@@ -13800,7 +13828,7 @@ index f01186988..26a8c4ffe 100644
return this.j.d();
}
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 5b0b6edfa..2155fa1b1 100644
index 5b0b6edfa..bb310c745 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -55,12 +55,13 @@ import org.bukkit.event.server.MapInitializeEvent;
@@ -13991,7 +14019,7 @@ index 5b0b6edfa..2155fa1b1 100644
+ boolean ret = false;
+
+ if (entity != null) {
+ if (this.getWorldBorder().isCollidingOnBorderEdge(axisalignedbb)) {
+ if (this.getWorldBorder().isAlmostCollidingOnBorder(axisalignedbb)) {
+ if (checkOnly) {
+ return true;
+ } else {