Skip to content

Commit

Permalink
Updated Upstream (Tuinity)
Browse files Browse the repository at this point in the history
Upstream has released updates that appears to apply and compile correctly

Tuinity Changes:
ed9c0c4 Fix worldborder checks for getCubes
  • Loading branch information
BillyGalbreath committed Nov 22, 2020
1 parent 3e0a758 commit 058399c
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 67 deletions.
2 changes: 1 addition & 1 deletion current-paper
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.16.4--f3e24bfd596d4a095bab3d78733012a035d02546
1.16.4--d29be096a48a1d0e7f74c579efd9dfcea2c56ad5
112 changes: 70 additions & 42 deletions patches/server/0001-Tuinity-Server-Changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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) {
Expand All @@ -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;
Expand Down Expand Up @@ -5685,23 +5694,23 @@ 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);
}

+ public final AxisAlignedBB offset(double d0, double d1, double d2) { return this.d(d0, d1, d2); } // Tuinity - OBFHELPER
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());
}

+ public final AxisAlignedBB offset(Vec3D vec3d) { return this.b(vec3d); } // Tuinity - OBFHELPER
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);
}

Expand Down Expand Up @@ -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 @@
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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);
+
Expand Down Expand Up @@ -8191,15 +8203,15 @@ 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;
}

+ public static double getXZSquared(Vec3D vec3d) { return Entity.c(vec3d); } // Tuinity - OBFHELPER
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() {
Expand Down Expand Up @@ -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
}
}
}
Expand All @@ -8249,15 +8261,15 @@ 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;
}

+ public final double getDistanceSquared(Entity other) { return this.h(other); } // Tuinity - OBFHELPER
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());

Expand All @@ -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;
}

Expand All @@ -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;
}

Expand All @@ -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) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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);
}

Expand All @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0044-Cows-eat-mushrooms.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Cows eat mushrooms


diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 870868f0e..1987555a9 100644
index a1ffbfb3a..3cb24f4ff 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2766,6 +2766,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -2769,6 +2769,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
this.invulnerable = flag;
}

Expand Down
4 changes: 2 additions & 2 deletions patches/server/0059-Fix-the-dead-lagging-the-server.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Fix the dead lagging the server


diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 1987555a9..01f4be387 100644
index 3cb24f4ff..fba2e13ae 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1518,6 +1518,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -1521,6 +1521,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
this.pitch = MathHelper.a(f1, -90.0F, 90.0F) % 360.0F;
this.lastYaw = this.yaw;
this.lastPitch = this.pitch;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Climbing should not bypass cramming gamerule


diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index e0532f145..763625294 100644
index 6841de575..9f465ff6f 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1717,6 +1717,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -1720,6 +1720,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
}

public boolean isCollidable() {
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0084-Item-entity-immunities.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Item entity immunities


diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 763625294..f03890d40 100644
index 9f465ff6f..7892ae36a 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1467,6 +1467,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -1470,6 +1470,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ index 6fe5678cf..bd0267ee4 100644
return (new EntityDamageSourceIndirect("indirectMagic", entity, entity1)).setIgnoreArmor().setMagic();
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index f03890d40..1ae6dd961 100644
index 7892ae36a..87d40ea50 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2132,8 +2132,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -2135,8 +2135,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
return this.a(new ItemStack(imaterial), (float) i);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Stop squids floating on top of water


diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 1ae6dd961..b433bf6e6 100644
index 87d40ea50..d76a93dc1 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -3435,8 +3435,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -3438,8 +3438,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
this.lastYaw = this.yaw;
}

Expand Down
Loading

0 comments on commit 058399c

Please sign in to comment.