Make worldborder collisions consistent with Vanilla

Vanilla now requires the use of WorldBorder#isInsideCloseToBorder
to consider a border collision
This commit is contained in:
Spottedleaf 2023-12-18 17:12:55 -08:00
parent e3140fb70e
commit 0b952981e6
15 changed files with 54 additions and 107 deletions

View file

@ -105,10 +105,10 @@ index be668387f65a633c6ac497fca632a4767a1bf3a2..e08f4e39db4ee3fed62e37364d17dcc5
} }
diff --git a/src/main/java/io/papermc/paper/util/CollisionUtil.java b/src/main/java/io/papermc/paper/util/CollisionUtil.java diff --git a/src/main/java/io/papermc/paper/util/CollisionUtil.java b/src/main/java/io/papermc/paper/util/CollisionUtil.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..5d4c5cc8eb06f2e6c31df6cbb98ea642b2264d49 index 0000000000000000000000000000000000000000..acd8470b108432ac82e1d2f6efcaabd5540214c2
--- /dev/null --- /dev/null
+++ b/src/main/java/io/papermc/paper/util/CollisionUtil.java +++ b/src/main/java/io/papermc/paper/util/CollisionUtil.java
@@ -0,0 +1,1878 @@ @@ -0,0 +1,1850 @@
+package io.papermc.paper.util; +package io.papermc.paper.util;
+ +
+import io.papermc.paper.util.collisions.CachedShapeData; +import io.papermc.paper.util.collisions.CachedShapeData;
@ -1649,41 +1649,12 @@ index 0000000000000000000000000000000000000000..5d4c5cc8eb06f2e6c31df6cbb98ea642
+ return new Vec3(x, y, z); + return new Vec3(x, y, z);
+ } + }
+ +
+ public static boolean isAlmostCollidingOnBorder(final WorldBorder worldborder, final AABB boundingBox) { + public static boolean isCollidingWithBorder(final WorldBorder worldborder, final AABB boundingBox) {
+ return isAlmostCollidingOnBorder(worldborder, boundingBox.minX, boundingBox.maxX, boundingBox.minZ, boundingBox.maxZ); + return isCollidingWithBorder(worldborder, boundingBox.minX, boundingBox.maxX, boundingBox.minZ, boundingBox.maxZ);
+ } + }
+ +
+ public static boolean isAlmostCollidingOnBorder(final WorldBorder worldborder, final double boxMinX, final double boxMaxX, + public static boolean isCollidingWithBorder(final WorldBorder worldborder, final double boxMinX, final double boxMaxX,
+ final double boxMinZ, final double boxMaxZ) { + final double boxMinZ, final double boxMaxZ) {
+ final double borderMinX = worldborder.getMinX(); // -X
+ final double borderMaxX = worldborder.getMaxX(); // +X
+
+ final double borderMinZ = worldborder.getMinZ(); // -Z
+ final double borderMaxZ = worldborder.getMaxZ(); // +Z
+
+ return
+ // Not intersecting if we're smaller
+ !voxelShapeIntersect(
+ boxMinX + COLLISION_EPSILON, Double.NEGATIVE_INFINITY, boxMinZ + COLLISION_EPSILON,
+ boxMaxX - COLLISION_EPSILON, Double.POSITIVE_INFINITY, boxMaxZ - COLLISION_EPSILON,
+ borderMinX, Double.NEGATIVE_INFINITY, borderMinZ, borderMaxX, Double.POSITIVE_INFINITY, borderMaxZ
+ )
+ &&
+
+ // Are intersecting if we're larger
+ voxelShapeIntersect(
+ boxMinX - COLLISION_EPSILON, Double.NEGATIVE_INFINITY, boxMinZ - COLLISION_EPSILON,
+ boxMaxX + COLLISION_EPSILON, Double.POSITIVE_INFINITY, boxMaxZ + COLLISION_EPSILON,
+ borderMinX, Double.NEGATIVE_INFINITY, borderMinZ, borderMaxX, Double.POSITIVE_INFINITY, borderMaxZ
+ );
+ }
+
+ public static boolean isCollidingWithBorderEdge(final WorldBorder worldborder, final AABB boundingBox) {
+ return isCollidingWithBorderEdge(worldborder, boundingBox.minX, boundingBox.maxX, boundingBox.minZ, boundingBox.maxZ);
+ }
+
+ public static boolean isCollidingWithBorderEdge(final WorldBorder worldborder, final double boxMinX, final double boxMaxX,
+ final double boxMinZ, final double boxMaxZ) {
+ final double borderMinX = worldborder.getMinX(); // -X + final double borderMinX = worldborder.getMinX(); // -X
+ final double borderMaxX = worldborder.getMaxX(); // +X + final double borderMaxX = worldborder.getMaxX(); // +X
+ +
@ -1716,11 +1687,12 @@ index 0000000000000000000000000000000000000000..5d4c5cc8eb06f2e6c31df6cbb98ea642
+ boolean ret = false; + boolean ret = false;
+ +
+ if ((collisionFlags & COLLISION_FLAG_CHECK_BORDER) != 0) { + if ((collisionFlags & COLLISION_FLAG_CHECK_BORDER) != 0) {
+ if (CollisionUtil.isCollidingWithBorderEdge(world.getWorldBorder(), aabb)) { + final WorldBorder worldBorder = world.getWorldBorder();
+ if (CollisionUtil.isCollidingWithBorder(worldBorder, aabb) && entity != null && worldBorder.isInsideCloseToBorder(entity, aabb)) {
+ if (checkOnly) { + if (checkOnly) {
+ return true; + return true;
+ } else { + } else {
+ final VoxelShape borderShape = world.getWorldBorder().getCollisionShape(); + final VoxelShape borderShape = worldBorder.getCollisionShape();
+ intoVoxel.add(borderShape); + intoVoxel.add(borderShape);
+ ret = true; + ret = true;
+ } + }
@ -2241,7 +2213,7 @@ index 53dbfb828f4d6f47b87e7ff6829a8dbc3de2f0fd..30ad9f878d0b76c6bef594448c3122d6
entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ()); entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ());
} }
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 09a49aa1f33796ab5947010538f504c49d2af226..b8c5c8ecf1a1a2bddcf8df15042e617908ab122c 100644 index 09a49aa1f33796ab5947010538f504c49d2af226..5a6536bf3503ba27df8bdd810b76266aee42e037 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
@@ -1215,9 +1215,44 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -1215,9 +1215,44 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@ -2292,7 +2264,7 @@ index 09a49aa1f33796ab5947010538f504c49d2af226..b8c5c8ecf1a1a2bddcf8df15042e6179
if (this.remainingFireTicks <= 0) { if (this.remainingFireTicks <= 0) {
this.setRemainingFireTicks(-this.getFireImmuneTicks()); this.setRemainingFireTicks(-this.getFireImmuneTicks());
} }
@@ -1397,32 +1432,86 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -1397,32 +1432,82 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
} }
private Vec3 collide(Vec3 movement) { private Vec3 collide(Vec3 movement) {
@ -2346,31 +2318,27 @@ index 09a49aa1f33796ab5947010538f504c49d2af226..b8c5c8ecf1a1a2bddcf8df15042e6179
+ +
+ io.papermc.paper.util.CollisionUtil.getCollisions( + io.papermc.paper.util.CollisionUtil.getCollisions(
+ world, this, collisionBox, potentialCollisionsVoxel, potentialCollisionsBB, + world, this, collisionBox, potentialCollisionsVoxel, potentialCollisionsBB,
+ (0), + io.papermc.paper.util.CollisionUtil.COLLISION_FLAG_CHECK_BORDER,
+ null, null + null, null
+ ); + );
+ +
+ if (io.papermc.paper.util.CollisionUtil.isCollidingWithBorderEdge(world.getWorldBorder(), collisionBox)) { + if (potentialCollisionsVoxel.isEmpty() && potentialCollisionsBB.isEmpty()) {
+ potentialCollisionsVoxel.add(world.getWorldBorder().getCollisionShape()); + return movement;
+ } + }
- if (this.maxUpStep() > 0.0F && flag3 && (flag || flag2)) { - if (this.maxUpStep() > 0.0F && flag3 && (flag || flag2)) {
- Vec3 vec3d2 = Entity.collideBoundingBox(this, new Vec3(movement.x, (double) this.maxUpStep(), movement.z), axisalignedbb, this.level(), list); - Vec3 vec3d2 = Entity.collideBoundingBox(this, new Vec3(movement.x, (double) this.maxUpStep(), movement.z), axisalignedbb, this.level(), list);
- Vec3 vec3d3 = Entity.collideBoundingBox(this, new Vec3(0.0D, (double) this.maxUpStep(), 0.0D), axisalignedbb.expandTowards(movement.x, 0.0D, movement.z), this.level(), list); - Vec3 vec3d3 = Entity.collideBoundingBox(this, new Vec3(0.0D, (double) this.maxUpStep(), 0.0D), axisalignedbb.expandTowards(movement.x, 0.0D, movement.z), this.level(), list);
+ if (potentialCollisionsVoxel.isEmpty() && potentialCollisionsBB.isEmpty()) {
+ return movement;
+ }
+
+ final Vec3 limitedMoveVector = io.papermc.paper.util.CollisionUtil.performCollisions(movement, currBoundingBox, potentialCollisionsVoxel, potentialCollisionsBB); + final Vec3 limitedMoveVector = io.papermc.paper.util.CollisionUtil.performCollisions(movement, currBoundingBox, potentialCollisionsVoxel, potentialCollisionsBB);
+
- if (vec3d3.y < (double) this.maxUpStep()) {
- Vec3 vec3d4 = Entity.collideBoundingBox(this, new Vec3(movement.x, 0.0D, movement.z), axisalignedbb.move(vec3d3), this.level(), list).add(vec3d3);
+ if (stepHeight > 0.0 + if (stepHeight > 0.0
+ && (onGround || (limitedMoveVector.y != movement.y && movement.y < 0.0)) + && (onGround || (limitedMoveVector.y != movement.y && movement.y < 0.0))
+ && (limitedMoveVector.x != movement.x || limitedMoveVector.z != movement.z)) { + && (limitedMoveVector.x != movement.x || limitedMoveVector.z != movement.z)) {
+ Vec3 vec3d2 = io.papermc.paper.util.CollisionUtil.performCollisions(new Vec3(movement.x, stepHeight, movement.z), currBoundingBox, potentialCollisionsVoxel, potentialCollisionsBB); + Vec3 vec3d2 = io.papermc.paper.util.CollisionUtil.performCollisions(new Vec3(movement.x, stepHeight, movement.z), currBoundingBox, potentialCollisionsVoxel, potentialCollisionsBB);
+ final Vec3 vec3d3 = io.papermc.paper.util.CollisionUtil.performCollisions(new Vec3(0.0, stepHeight, 0.0), currBoundingBox.expandTowards(movement.x, 0.0, movement.z), potentialCollisionsVoxel, potentialCollisionsBB); + final Vec3 vec3d3 = io.papermc.paper.util.CollisionUtil.performCollisions(new Vec3(0.0, stepHeight, 0.0), currBoundingBox.expandTowards(movement.x, 0.0, movement.z), potentialCollisionsVoxel, potentialCollisionsBB);
+
- if (vec3d3.y < (double) this.maxUpStep()) {
- Vec3 vec3d4 = Entity.collideBoundingBox(this, new Vec3(movement.x, 0.0D, movement.z), axisalignedbb.move(vec3d3), this.level(), list).add(vec3d3);
+ if (vec3d3.y < stepHeight) { + if (vec3d3.y < stepHeight) {
+ final Vec3 vec3d4 = io.papermc.paper.util.CollisionUtil.performCollisions(new Vec3(movement.x, 0.0D, movement.z), currBoundingBox.move(vec3d3), potentialCollisionsVoxel, potentialCollisionsBB).add(vec3d3); + final Vec3 vec3d4 = io.papermc.paper.util.CollisionUtil.performCollisions(new Vec3(movement.x, 0.0D, movement.z), currBoundingBox.move(vec3d3), potentialCollisionsVoxel, potentialCollisionsBB).add(vec3d3);
@ -2395,7 +2363,7 @@ index 09a49aa1f33796ab5947010538f504c49d2af226..b8c5c8ecf1a1a2bddcf8df15042e6179
} }
public static Vec3 collideBoundingBox(@Nullable Entity entity, Vec3 movement, AABB entityBoundingBox, Level world, List<VoxelShape> collisions) { public static Vec3 collideBoundingBox(@Nullable Entity entity, Vec3 movement, AABB entityBoundingBox, Level world, List<VoxelShape> collisions) {
@@ -2627,11 +2716,70 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -2627,11 +2712,70 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
float f = this.dimensions.width * 0.8F; float f = this.dimensions.width * 0.8F;
AABB axisalignedbb = AABB.ofSize(this.getEyePosition(), (double) f, 1.0E-6D, (double) f); AABB axisalignedbb = AABB.ofSize(this.getEyePosition(), (double) f, 1.0E-6D, (double) f);

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Forward CraftEntity in teleport command
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 b8c5c8ecf1a1a2bddcf8df15042e617908ab122c..584a254d1a5222d404f5bc8062830cb82c228a66 100644 index 5a6536bf3503ba27df8bdd810b76266aee42e037..72badd1d14107a665f8730c9dc0aba91a1950caf 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
@@ -3535,6 +3535,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -3531,6 +3531,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
} }
public void restoreFrom(Entity original) { public void restoreFrom(Entity original) {
@ -22,7 +22,7 @@ index b8c5c8ecf1a1a2bddcf8df15042e617908ab122c..584a254d1a5222d404f5bc8062830cb8
CompoundTag nbttagcompound = original.saveWithoutId(new CompoundTag()); CompoundTag nbttagcompound = original.saveWithoutId(new CompoundTag());
nbttagcompound.remove("Dimension"); nbttagcompound.remove("Dimension");
@@ -3625,10 +3632,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -3621,10 +3628,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
} }
} }
// CraftBukkit end // CraftBukkit end

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Freeze Tick Lock API
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 584a254d1a5222d404f5bc8062830cb82c228a66..8f178446ee632ae2aad735cae2edf6db96250f43 100644 index 72badd1d14107a665f8730c9dc0aba91a1950caf..225ad411a48c156bcd1973f97349db80b0ff6a92 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
@@ -407,6 +407,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -407,6 +407,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@ -25,7 +25,7 @@ index 584a254d1a5222d404f5bc8062830cb82c228a66..8f178446ee632ae2aad735cae2edf6db
this.setTicksFrozen(0); this.setTicksFrozen(0);
this.level().levelEvent((Player) null, 1009, this.blockPosition, 1); this.level().levelEvent((Player) null, 1009, this.blockPosition, 1);
} }
@@ -2456,6 +2457,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -2452,6 +2453,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
if (fromNetherPortal) { if (fromNetherPortal) {
nbttagcompound.putBoolean("Paper.FromNetherPortal", true); nbttagcompound.putBoolean("Paper.FromNetherPortal", true);
} }
@ -35,7 +35,7 @@ index 584a254d1a5222d404f5bc8062830cb82c228a66..8f178446ee632ae2aad735cae2edf6db
// Paper end // Paper end
return nbttagcompound; return nbttagcompound;
} catch (Throwable throwable) { } catch (Throwable throwable) {
@@ -2600,6 +2604,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -2596,6 +2600,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
if (spawnReason == null) { if (spawnReason == null) {
spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT;
} }

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Ensure entity passenger world matches ridden entity
Bad plugins doing this would cause some obvious problems... Bad plugins doing this would cause some obvious problems...
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 8f178446ee632ae2aad735cae2edf6db96250f43..3fc282f8211eb3a7a7d096cc22b1bdb6545d70fa 100644 index 225ad411a48c156bcd1973f97349db80b0ff6a92..32d97353a5f030fa46ea637e546ef0856122b391 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
@@ -2849,7 +2849,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -2845,7 +2845,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
} }
public boolean startRiding(Entity entity, boolean force) { public boolean startRiding(Entity entity, boolean force) {

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Guard against invalid entity positions
Anything not finite should be blocked and logged Anything not finite should be blocked and logged
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 3fc282f8211eb3a7a7d096cc22b1bdb6545d70fa..8c20610c57ba90df364c9a65e867e35c9920a770 100644 index 32d97353a5f030fa46ea637e546ef0856122b391..7179939c141d4c08e4d52ad8388625024dc8021c 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
@@ -4543,11 +4543,33 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -4539,11 +4539,33 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return this.getZ((2.0D * this.random.nextDouble() - 1.0D) * widthScale); return this.getZ((2.0D * this.random.nextDouble() - 1.0D) * widthScale);
} }

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add various missing EntityDropItemEvent calls
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 78a0be97cffbf2387ee4c05a00bf039a8c0474e1..17e781869a53791d9f928ab99883c9ef68ed0e27 100644 index 4c4c23df45a951a3d34b801463957b2cf589161a..b583abba5a32468383336c7a354bf96553544fc3 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
@@ -2701,6 +2701,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -2697,6 +2697,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
stack.setCount(0); // Paper - destroy this item - if this ever leaks due to game bugs, ensure it doesn't dupe stack.setCount(0); // Paper - destroy this item - if this ever leaks due to game bugs, ensure it doesn't dupe
entityitem.setDefaultPickUpDelay(); entityitem.setDefaultPickUpDelay();

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add EntityPortalReadyEvent
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 17e781869a53791d9f928ab99883c9ef68ed0e27..52504f71a34fe8700c68533ff82d98fe23f8edc9 100644 index b583abba5a32468383336c7a354bf96553544fc3..ab91ff78d943a4b0c0ea6af1781b2e64ec7ca1fa 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
@@ -3103,6 +3103,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -3099,6 +3099,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
if (true && !this.isPassenger() && this.portalTime++ >= i) { // CraftBukkit if (true && !this.isPassenger() && this.portalTime++ >= i) { // CraftBukkit
this.level().getProfiler().push("portal"); this.level().getProfiler().push("portal");
this.portalTime = i; this.portalTime = i;
@ -22,7 +22,7 @@ index 17e781869a53791d9f928ab99883c9ef68ed0e27..52504f71a34fe8700c68533ff82d98fe
this.setPortalCooldown(); this.setPortalCooldown();
// CraftBukkit start // CraftBukkit start
if (this instanceof ServerPlayer) { if (this instanceof ServerPlayer) {
@@ -3110,6 +3117,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -3106,6 +3113,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
} else { } else {
this.changeDimension(worldserver1); this.changeDimension(worldserver1);
} }

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Fix EntityCombustEvent cancellation cant fully prevent
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 52504f71a34fe8700c68533ff82d98fe23f8edc9..e758f3dce618c7b021ea1828c1b2fc3807455f4a 100644 index ab91ff78d943a4b0c0ea6af1781b2e64ec7ca1fa..89defc6e1e95fdd7d76ae3af0282066819831c9e 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
@@ -3382,6 +3382,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -3378,6 +3378,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
pluginManager.callEvent(entityCombustEvent); pluginManager.callEvent(entityCombustEvent);
if (!entityCombustEvent.isCancelled()) { if (!entityCombustEvent.isCancelled()) {
this.setSecondsOnFire(entityCombustEvent.getDuration(), false); this.setSecondsOnFire(entityCombustEvent.getDuration(), false);

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Improve PortalEvents
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 e758f3dce618c7b021ea1828c1b2fc3807455f4a..bfbb99e82c00eef9772c605e172645252af6e8ad 100644 index 89defc6e1e95fdd7d76ae3af0282066819831c9e..7da95c2c02493c8a472488d7f8e6f63fbe807c8e 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
@@ -3769,7 +3769,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -3765,7 +3765,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
Location enter = bukkitEntity.getLocation(); Location enter = bukkitEntity.getLocation();
Location exit = CraftLocation.toBukkit(exitPosition, exitWorldServer.getWorld()); Location exit = CraftLocation.toBukkit(exitPosition, exitWorldServer.getWorld());

View file

@ -4,29 +4,8 @@ Date: Thu, 27 Oct 2022 15:35:47 +0200
Subject: [PATCH] Add config option for spider worldborder climbing Subject: [PATCH] Add config option for spider worldborder climbing
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index bfbb99e82c00eef9772c605e172645252af6e8ad..620ff3a4741742f27d0998d22bb5b998af7aaa83 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -408,6 +408,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@javax.annotation.Nullable
private UUID originWorld;
public boolean freezeLocked = false; // Paper - Freeze Tick Lock API
+ public boolean collidingWithWorldBorder; // Paper
public void setOrigin(@javax.annotation.Nonnull Location location) {
this.origin = location.toVector();
@@ -1481,7 +1482,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
null, null
);
- if (io.papermc.paper.util.CollisionUtil.isCollidingWithBorderEdge(world.getWorldBorder(), collisionBox)) {
+ if (collidingWithWorldBorder = io.papermc.paper.util.CollisionUtil.isCollidingWithBorderEdge(world.getWorldBorder(), collisionBox)) { // Paper - this line *is* correct, ignore the IDE warning about assignments being used as a condition
potentialCollisionsVoxel.add(world.getWorldBorder().getCollisionShape());
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/Spider.java b/src/main/java/net/minecraft/world/entity/monster/Spider.java diff --git a/src/main/java/net/minecraft/world/entity/monster/Spider.java b/src/main/java/net/minecraft/world/entity/monster/Spider.java
index 9e5d68fe86d17118df3d6a1c36b296f32b4d7fc1..71b5a9c97a13f703073c0122742ff9e8a0e49df2 100644 index 9e5d68fe86d17118df3d6a1c36b296f32b4d7fc1..5a9f4a022c8e7a0804543335bfe91e1328d040e6 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Spider.java --- a/src/main/java/net/minecraft/world/entity/monster/Spider.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Spider.java +++ b/src/main/java/net/minecraft/world/entity/monster/Spider.java
@@ -86,7 +86,7 @@ public class Spider extends Monster { @@ -86,7 +86,7 @@ public class Spider extends Monster {
@ -34,7 +13,7 @@ index 9e5d68fe86d17118df3d6a1c36b296f32b4d7fc1..71b5a9c97a13f703073c0122742ff9e8
super.tick(); super.tick();
if (!this.level().isClientSide) { if (!this.level().isClientSide) {
- this.setClimbing(this.horizontalCollision); - this.setClimbing(this.horizontalCollision);
+ this.setClimbing(this.horizontalCollision && (this.level().paperConfig().entities.behavior.allowSpiderWorldBorderClimbing || !collidingWithWorldBorder)); // Paper + this.setClimbing(this.horizontalCollision && (this.level().paperConfig().entities.behavior.allowSpiderWorldBorderClimbing || !io.papermc.paper.util.CollisionUtil.isCollidingWithBorder(this.level().getWorldBorder(), this.getBoundingBox().inflate(io.papermc.paper.util.CollisionUtil.COLLISION_EPSILON)))); // Paper - inflate by +EPSILON as collision will place us outside the border, but just barely
} }
} }

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Expose pre-collision moving velocity to
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 620ff3a4741742f27d0998d22bb5b998af7aaa83..dad8faf21093f351bd4d66b99ab16caf8bda608f 100644 index 7da95c2c02493c8a472488d7f8e6f63fbe807c8e..00c88798099c72f8682ac3547da96af6830567b4 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
@@ -1161,7 +1161,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -1160,7 +1160,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
} }
if (!bl.getType().isAir()) { if (!bl.getType().isAir()) {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Don't load chunks for supporting block checks
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 ed91a1d8877f8d2b2be26389f10d5323e3975b30..8af2d49fdb46deab17fd801e5ba56eec289b4dd0 100644 index 96cfc5323cf080540c934c54ac00488e5babcea5..903fa8c1489541e141bef59239ecd645955ffca4 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
@@ -1361,7 +1361,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -1360,7 +1360,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
} }
protected BlockPos getOnPos(float offset) { protected BlockPos getOnPos(float offset) {

View file

@ -1158,7 +1158,7 @@ index 3927558c62cf24af915d37eb8e983339bc0f2aa3..895c4accbcf43baaa8a4d560e8b5c0d4
this.players.remove(entityplayer); this.players.remove(entityplayer);
this.playersByName.remove(entityplayer.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot this.playersByName.remove(entityplayer.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot
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 8af2d49fdb46deab17fd801e5ba56eec289b4dd0..23488823fe48f502c1f64ace79030bf0f7e85626 100644 index 903fa8c1489541e141bef59239ecd645955ffca4..a561da947df33d85a6bb6f61e88a2b5fe57b5c32 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
@@ -247,11 +247,23 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -247,11 +247,23 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@ -1186,7 +1186,7 @@ index 8af2d49fdb46deab17fd801e5ba56eec289b4dd0..23488823fe48f502c1f64ace79030bf0
@Override @Override
public CommandSender getBukkitSender(CommandSourceStack wrapper) { public CommandSender getBukkitSender(CommandSourceStack wrapper) {
return this.getBukkitEntity(); return this.getBukkitEntity();
@@ -4739,6 +4751,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -4734,6 +4746,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return; return;
} }
// Paper end - rewrite chunk system // Paper end - rewrite chunk system
@ -1194,7 +1194,7 @@ index 8af2d49fdb46deab17fd801e5ba56eec289b4dd0..23488823fe48f502c1f64ace79030bf0
if (this.removalReason == null) { if (this.removalReason == null) {
this.removalReason = reason; this.removalReason = reason;
} }
@@ -4749,12 +4762,28 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -4744,12 +4757,28 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
if (reason != RemovalReason.UNLOADED_TO_CHUNK) this.getPassengers().forEach(Entity::stopRiding); // Paper - chunk system - don't adjust passenger state when unloading, it's just not safe (and messes with our logic in entity chunk unload) if (reason != RemovalReason.UNLOADED_TO_CHUNK) this.getPassengers().forEach(Entity::stopRiding); // Paper - chunk system - don't adjust passenger state when unloading, it's just not safe (and messes with our logic in entity chunk unload)
this.levelCallback.onRemove(reason); this.levelCallback.onRemove(reason);

View file

@ -5,18 +5,18 @@ Subject: [PATCH] Expand Pose API
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 23488823fe48f502c1f64ace79030bf0f7e85626..62bdce9516804942862b33667bc571e3bcac1a70 100644 index a561da947df33d85a6bb6f61e88a2b5fe57b5c32..1f2e74969f9d459cf3bc123c96309fc0a6165ea0 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
@@ -422,6 +422,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -421,6 +421,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@javax.annotation.Nullable
private UUID originWorld; private UUID originWorld;
public boolean freezeLocked = false; // Paper - Freeze Tick Lock API public boolean freezeLocked = false; // Paper - Freeze Tick Lock API
public boolean collidingWithWorldBorder; // Paper
+ public boolean fixedPose = false; // Paper + public boolean fixedPose = false; // Paper
public void setOrigin(@javax.annotation.Nonnull Location location) { public void setOrigin(@javax.annotation.Nonnull Location location) {
this.origin = location.toVector(); this.origin = location.toVector();
@@ -706,6 +707,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -705,6 +706,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
public void onClientRemoval() {} public void onClientRemoval() {}
public void setPose(net.minecraft.world.entity.Pose pose) { public void setPose(net.minecraft.world.entity.Pose pose) {

View file

@ -39,10 +39,10 @@ index 5fe743567f2e9cf0f9442ddd87453c51af8060e6..8efbbd379244e3ed54d4aba199037cc2
} // Paper } // Paper
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 62bdce9516804942862b33667bc571e3bcac1a70..9abe817ae202edaa2d88cd59ae5c7db0b1c634be 100644 index 1f2e74969f9d459cf3bc123c96309fc0a6165ea0..0c46a4aeafd03fbbfd590b0362d41bf2b1d5ca74 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
@@ -2702,6 +2702,25 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -2697,6 +2697,25 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@Nullable @Nullable
public ItemEntity spawnAtLocation(ItemStack stack, float yOffset) { public ItemEntity spawnAtLocation(ItemStack stack, float yOffset) {
@ -68,7 +68,7 @@ index 62bdce9516804942862b33667bc571e3bcac1a70..9abe817ae202edaa2d88cd59ae5c7db0
if (stack.isEmpty()) { if (stack.isEmpty()) {
return null; return null;
} else if (this.level().isClientSide) { } else if (this.level().isClientSide) {
@@ -2709,14 +2728,21 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -2704,14 +2723,21 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
} else { } else {
// CraftBukkit start - Capture drops for death event // CraftBukkit start - Capture drops for death event
if (this instanceof net.minecraft.world.entity.LivingEntity && !((net.minecraft.world.entity.LivingEntity) this).forceDrops) { if (this instanceof net.minecraft.world.entity.LivingEntity && !((net.minecraft.world.entity.LivingEntity) this).forceDrops) {