From 0b952981e6e96157d2cea8322c04c0f69965f2bf Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Mon, 18 Dec 2023 17:12:55 -0800 Subject: [PATCH] Make worldborder collisions consistent with Vanilla Vanilla now requires the use of WorldBorder#isInsideCloseToBorder to consider a border collision --- .../server/0719-Collision-optimisations.patch | 70 +++++-------------- ...ward-CraftEntity-in-teleport-command.patch | 6 +- .../server/0748-Freeze-Tick-Lock-API.patch | 6 +- ...assenger-world-matches-ridden-entity.patch | 4 +- ...ard-against-invalid-entity-positions.patch | 4 +- ...us-missing-EntityDropItemEvent-calls.patch | 4 +- .../0823-Add-EntityPortalReadyEvent.patch | 6 +- ...tEvent-cancellation-cant-fully-preve.patch | 4 +- .../server/0890-Improve-PortalEvents.patch | 4 +- ...tion-for-spider-worldborder-climbing.patch | 25 +------ ...sion-moving-velocity-to-VehicleBlock.patch | 4 +- ...d-chunks-for-supporting-block-checks.patch | 4 +- ...Folia-scheduler-and-owned-region-API.patch | 6 +- patches/server/0989-Expand-Pose-API.patch | 8 +-- ...estore-vanilla-entity-drops-behavior.patch | 6 +- 15 files changed, 54 insertions(+), 107 deletions(-) diff --git a/patches/server/0719-Collision-optimisations.patch b/patches/server/0719-Collision-optimisations.patch index 62c51edd7e..0fe98a30e9 100644 --- a/patches/server/0719-Collision-optimisations.patch +++ b/patches/server/0719-Collision-optimisations.patch @@ -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 new file mode 100644 -index 0000000000000000000000000000000000000000..5d4c5cc8eb06f2e6c31df6cbb98ea642b2264d49 +index 0000000000000000000000000000000000000000..acd8470b108432ac82e1d2f6efcaabd5540214c2 --- /dev/null +++ b/src/main/java/io/papermc/paper/util/CollisionUtil.java -@@ -0,0 +1,1878 @@ +@@ -0,0 +1,1850 @@ +package io.papermc.paper.util; + +import io.papermc.paper.util.collisions.CachedShapeData; @@ -1649,41 +1649,12 @@ index 0000000000000000000000000000000000000000..5d4c5cc8eb06f2e6c31df6cbb98ea642 + return new Vec3(x, y, z); + } + -+ public static boolean isAlmostCollidingOnBorder(final WorldBorder worldborder, final AABB boundingBox) { -+ return isAlmostCollidingOnBorder(worldborder, boundingBox.minX, boundingBox.maxX, boundingBox.minZ, boundingBox.maxZ); ++ public static boolean isCollidingWithBorder(final WorldBorder worldborder, final AABB boundingBox) { ++ return isCollidingWithBorder(worldborder, boundingBox.minX, boundingBox.maxX, boundingBox.minZ, boundingBox.maxZ); + } + -+ public static boolean isAlmostCollidingOnBorder(final WorldBorder worldborder, final double boxMinX, final double boxMaxX, -+ 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) { ++ public static boolean isCollidingWithBorder(final WorldBorder worldborder, final double boxMinX, final double boxMaxX, ++ final double boxMinZ, final double boxMaxZ) { + final double borderMinX = worldborder.getMinX(); // -X + final double borderMaxX = worldborder.getMaxX(); // +X + @@ -1716,11 +1687,12 @@ index 0000000000000000000000000000000000000000..5d4c5cc8eb06f2e6c31df6cbb98ea642 + boolean ret = false; + + 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) { + return true; + } else { -+ final VoxelShape borderShape = world.getWorldBorder().getCollisionShape(); ++ final VoxelShape borderShape = worldBorder.getCollisionShape(); + intoVoxel.add(borderShape); + ret = true; + } @@ -2241,7 +2213,7 @@ index 53dbfb828f4d6f47b87e7ff6829a8dbc3de2f0fd..30ad9f878d0b76c6bef594448c3122d6 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 -index 09a49aa1f33796ab5947010538f504c49d2af226..b8c5c8ecf1a1a2bddcf8df15042e617908ab122c 100644 +index 09a49aa1f33796ab5947010538f504c49d2af226..5a6536bf3503ba27df8bdd810b76266aee42e037 100644 --- a/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 @@ -2292,7 +2264,7 @@ index 09a49aa1f33796ab5947010538f504c49d2af226..b8c5c8ecf1a1a2bddcf8df15042e6179 if (this.remainingFireTicks <= 0) { 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) { @@ -2346,31 +2318,27 @@ index 09a49aa1f33796ab5947010538f504c49d2af226..b8c5c8ecf1a1a2bddcf8df15042e6179 + + io.papermc.paper.util.CollisionUtil.getCollisions( + world, this, collisionBox, potentialCollisionsVoxel, potentialCollisionsBB, -+ (0), ++ io.papermc.paper.util.CollisionUtil.COLLISION_FLAG_CHECK_BORDER, + null, null + ); + -+ if (io.papermc.paper.util.CollisionUtil.isCollidingWithBorderEdge(world.getWorldBorder(), collisionBox)) { -+ potentialCollisionsVoxel.add(world.getWorldBorder().getCollisionShape()); ++ if (potentialCollisionsVoxel.isEmpty() && potentialCollisionsBB.isEmpty()) { ++ return movement; + } - 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 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); -+ + +- 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 + && (onGround || (limitedMoveVector.y != movement.y && movement.y < 0.0)) + && (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); + 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) { + 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 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; AABB axisalignedbb = AABB.ofSize(this.getEyePosition(), (double) f, 1.0E-6D, (double) f); diff --git a/patches/server/0725-Forward-CraftEntity-in-teleport-command.patch b/patches/server/0725-Forward-CraftEntity-in-teleport-command.patch index 614b09f4c6..ee05de0664 100644 --- a/patches/server/0725-Forward-CraftEntity-in-teleport-command.patch +++ b/patches/server/0725-Forward-CraftEntity-in-teleport-command.patch @@ -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 -index b8c5c8ecf1a1a2bddcf8df15042e617908ab122c..584a254d1a5222d404f5bc8062830cb82c228a66 100644 +index 5a6536bf3503ba27df8bdd810b76266aee42e037..72badd1d14107a665f8730c9dc0aba91a1950caf 100644 --- a/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) { @@ -22,7 +22,7 @@ index b8c5c8ecf1a1a2bddcf8df15042e617908ab122c..584a254d1a5222d404f5bc8062830cb8 CompoundTag nbttagcompound = original.saveWithoutId(new CompoundTag()); 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 diff --git a/patches/server/0748-Freeze-Tick-Lock-API.patch b/patches/server/0748-Freeze-Tick-Lock-API.patch index 7b08b79162..e437ecdf76 100644 --- a/patches/server/0748-Freeze-Tick-Lock-API.patch +++ b/patches/server/0748-Freeze-Tick-Lock-API.patch @@ -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 -index 584a254d1a5222d404f5bc8062830cb82c228a66..8f178446ee632ae2aad735cae2edf6db96250f43 100644 +index 72badd1d14107a665f8730c9dc0aba91a1950caf..225ad411a48c156bcd1973f97349db80b0ff6a92 100644 --- a/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 @@ -25,7 +25,7 @@ index 584a254d1a5222d404f5bc8062830cb82c228a66..8f178446ee632ae2aad735cae2edf6db this.setTicksFrozen(0); 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) { nbttagcompound.putBoolean("Paper.FromNetherPortal", true); } @@ -35,7 +35,7 @@ index 584a254d1a5222d404f5bc8062830cb82c228a66..8f178446ee632ae2aad735cae2edf6db // Paper end return nbttagcompound; } 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) { spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; } diff --git a/patches/server/0781-Ensure-entity-passenger-world-matches-ridden-entity.patch b/patches/server/0781-Ensure-entity-passenger-world-matches-ridden-entity.patch index 89d95d4c80..e75d82ac37 100644 --- a/patches/server/0781-Ensure-entity-passenger-world-matches-ridden-entity.patch +++ b/patches/server/0781-Ensure-entity-passenger-world-matches-ridden-entity.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Ensure entity passenger world matches ridden entity 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 -index 8f178446ee632ae2aad735cae2edf6db96250f43..3fc282f8211eb3a7a7d096cc22b1bdb6545d70fa 100644 +index 225ad411a48c156bcd1973f97349db80b0ff6a92..32d97353a5f030fa46ea637e546ef0856122b391 100644 --- a/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) { diff --git a/patches/server/0782-Guard-against-invalid-entity-positions.patch b/patches/server/0782-Guard-against-invalid-entity-positions.patch index 9ec2f9c8da..27f03de786 100644 --- a/patches/server/0782-Guard-against-invalid-entity-positions.patch +++ b/patches/server/0782-Guard-against-invalid-entity-positions.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Guard against invalid entity positions 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 -index 3fc282f8211eb3a7a7d096cc22b1bdb6545d70fa..8c20610c57ba90df364c9a65e867e35c9920a770 100644 +index 32d97353a5f030fa46ea637e546ef0856122b391..7179939c141d4c08e4d52ad8388625024dc8021c 100644 --- a/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); } diff --git a/patches/server/0819-Add-various-missing-EntityDropItemEvent-calls.patch b/patches/server/0819-Add-various-missing-EntityDropItemEvent-calls.patch index 9a5870d6fe..2c9631f498 100644 --- a/patches/server/0819-Add-various-missing-EntityDropItemEvent-calls.patch +++ b/patches/server/0819-Add-various-missing-EntityDropItemEvent-calls.patch @@ -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 -index 78a0be97cffbf2387ee4c05a00bf039a8c0474e1..17e781869a53791d9f928ab99883c9ef68ed0e27 100644 +index 4c4c23df45a951a3d34b801463957b2cf589161a..b583abba5a32468383336c7a354bf96553544fc3 100644 --- a/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 entityitem.setDefaultPickUpDelay(); diff --git a/patches/server/0823-Add-EntityPortalReadyEvent.patch b/patches/server/0823-Add-EntityPortalReadyEvent.patch index 8741a56d25..e82184bd04 100644 --- a/patches/server/0823-Add-EntityPortalReadyEvent.patch +++ b/patches/server/0823-Add-EntityPortalReadyEvent.patch @@ -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 -index 17e781869a53791d9f928ab99883c9ef68ed0e27..52504f71a34fe8700c68533ff82d98fe23f8edc9 100644 +index b583abba5a32468383336c7a354bf96553544fc3..ab91ff78d943a4b0c0ea6af1781b2e64ec7ca1fa 100644 --- a/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 this.level().getProfiler().push("portal"); this.portalTime = i; @@ -22,7 +22,7 @@ index 17e781869a53791d9f928ab99883c9ef68ed0e27..52504f71a34fe8700c68533ff82d98fe this.setPortalCooldown(); // CraftBukkit start 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 { this.changeDimension(worldserver1); } diff --git a/patches/server/0865-Fix-EntityCombustEvent-cancellation-cant-fully-preve.patch b/patches/server/0865-Fix-EntityCombustEvent-cancellation-cant-fully-preve.patch index b222f94c0e..fb2e8745e3 100644 --- a/patches/server/0865-Fix-EntityCombustEvent-cancellation-cant-fully-preve.patch +++ b/patches/server/0865-Fix-EntityCombustEvent-cancellation-cant-fully-preve.patch @@ -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 -index 52504f71a34fe8700c68533ff82d98fe23f8edc9..e758f3dce618c7b021ea1828c1b2fc3807455f4a 100644 +index ab91ff78d943a4b0c0ea6af1781b2e64ec7ca1fa..89defc6e1e95fdd7d76ae3af0282066819831c9e 100644 --- a/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); if (!entityCombustEvent.isCancelled()) { this.setSecondsOnFire(entityCombustEvent.getDuration(), false); diff --git a/patches/server/0890-Improve-PortalEvents.patch b/patches/server/0890-Improve-PortalEvents.patch index e4cfe4be44..cbe9f06001 100644 --- a/patches/server/0890-Improve-PortalEvents.patch +++ b/patches/server/0890-Improve-PortalEvents.patch @@ -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 -index e758f3dce618c7b021ea1828c1b2fc3807455f4a..bfbb99e82c00eef9772c605e172645252af6e8ad 100644 +index 89defc6e1e95fdd7d76ae3af0282066819831c9e..7da95c2c02493c8a472488d7f8e6f63fbe807c8e 100644 --- a/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 exit = CraftLocation.toBukkit(exitPosition, exitWorldServer.getWorld()); diff --git a/patches/server/0891-Add-config-option-for-spider-worldborder-climbing.patch b/patches/server/0891-Add-config-option-for-spider-worldborder-climbing.patch index 10224d6629..4ea94b6836 100644 --- a/patches/server/0891-Add-config-option-for-spider-worldborder-climbing.patch +++ b/patches/server/0891-Add-config-option-for-spider-worldborder-climbing.patch @@ -4,29 +4,8 @@ Date: Thu, 27 Oct 2022 15:35:47 +0200 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 -index 9e5d68fe86d17118df3d6a1c36b296f32b4d7fc1..71b5a9c97a13f703073c0122742ff9e8a0e49df2 100644 +index 9e5d68fe86d17118df3d6a1c36b296f32b4d7fc1..5a9f4a022c8e7a0804543335bfe91e1328d040e6 100644 --- a/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 { @@ -34,7 +13,7 @@ index 9e5d68fe86d17118df3d6a1c36b296f32b4d7fc1..71b5a9c97a13f703073c0122742ff9e8 super.tick(); if (!this.level().isClientSide) { - 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 } } diff --git a/patches/server/0896-Expose-pre-collision-moving-velocity-to-VehicleBlock.patch b/patches/server/0896-Expose-pre-collision-moving-velocity-to-VehicleBlock.patch index 8ef515d686..bd25e0fd3d 100644 --- a/patches/server/0896-Expose-pre-collision-moving-velocity-to-VehicleBlock.patch +++ b/patches/server/0896-Expose-pre-collision-moving-velocity-to-VehicleBlock.patch @@ -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 -index 620ff3a4741742f27d0998d22bb5b998af7aaa83..dad8faf21093f351bd4d66b99ab16caf8bda608f 100644 +index 7da95c2c02493c8a472488d7f8e6f63fbe807c8e..00c88798099c72f8682ac3547da96af6830567b4 100644 --- a/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()) { diff --git a/patches/server/0951-Don-t-load-chunks-for-supporting-block-checks.patch b/patches/server/0951-Don-t-load-chunks-for-supporting-block-checks.patch index 87c1a77544..333650ab84 100644 --- a/patches/server/0951-Don-t-load-chunks-for-supporting-block-checks.patch +++ b/patches/server/0951-Don-t-load-chunks-for-supporting-block-checks.patch @@ -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 -index ed91a1d8877f8d2b2be26389f10d5323e3975b30..8af2d49fdb46deab17fd801e5ba56eec289b4dd0 100644 +index 96cfc5323cf080540c934c54ac00488e5babcea5..903fa8c1489541e141bef59239ecd645955ffca4 100644 --- a/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) { diff --git a/patches/server/0965-Folia-scheduler-and-owned-region-API.patch b/patches/server/0965-Folia-scheduler-and-owned-region-API.patch index 612ca05c65..874018dfbc 100644 --- a/patches/server/0965-Folia-scheduler-and-owned-region-API.patch +++ b/patches/server/0965-Folia-scheduler-and-owned-region-API.patch @@ -1158,7 +1158,7 @@ index 3927558c62cf24af915d37eb8e983339bc0f2aa3..895c4accbcf43baaa8a4d560e8b5c0d4 this.players.remove(entityplayer); 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 -index 8af2d49fdb46deab17fd801e5ba56eec289b4dd0..23488823fe48f502c1f64ace79030bf0f7e85626 100644 +index 903fa8c1489541e141bef59239ecd645955ffca4..a561da947df33d85a6bb6f61e88a2b5fe57b5c32 100644 --- a/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 @@ -1186,7 +1186,7 @@ index 8af2d49fdb46deab17fd801e5ba56eec289b4dd0..23488823fe48f502c1f64ace79030bf0 @Override public CommandSender getBukkitSender(CommandSourceStack wrapper) { 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; } // Paper end - rewrite chunk system @@ -1194,7 +1194,7 @@ index 8af2d49fdb46deab17fd801e5ba56eec289b4dd0..23488823fe48f502c1f64ace79030bf0 if (this.removalReason == null) { 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) this.levelCallback.onRemove(reason); diff --git a/patches/server/0989-Expand-Pose-API.patch b/patches/server/0989-Expand-Pose-API.patch index 742d338e92..9162156dbe 100644 --- a/patches/server/0989-Expand-Pose-API.patch +++ b/patches/server/0989-Expand-Pose-API.patch @@ -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 -index 23488823fe48f502c1f64ace79030bf0f7e85626..62bdce9516804942862b33667bc571e3bcac1a70 100644 +index a561da947df33d85a6bb6f61e88a2b5fe57b5c32..1f2e74969f9d459cf3bc123c96309fc0a6165ea0 100644 --- a/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; public boolean freezeLocked = false; // Paper - Freeze Tick Lock API - public boolean collidingWithWorldBorder; // Paper + public boolean fixedPose = false; // Paper public void setOrigin(@javax.annotation.Nonnull Location location) { 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 setPose(net.minecraft.world.entity.Pose pose) { diff --git a/patches/server/1045-Restore-vanilla-entity-drops-behavior.patch b/patches/server/1045-Restore-vanilla-entity-drops-behavior.patch index 21ea7ded90..fb9e84e6e5 100644 --- a/patches/server/1045-Restore-vanilla-entity-drops-behavior.patch +++ b/patches/server/1045-Restore-vanilla-entity-drops-behavior.patch @@ -39,10 +39,10 @@ index 5fe743567f2e9cf0f9442ddd87453c51af8060e6..8efbbd379244e3ed54d4aba199037cc2 } // Paper 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 +++ 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 public ItemEntity spawnAtLocation(ItemStack stack, float yOffset) { @@ -68,7 +68,7 @@ index 62bdce9516804942862b33667bc571e3bcac1a70..9abe817ae202edaa2d88cd59ae5c7db0 if (stack.isEmpty()) { return null; } 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 { // CraftBukkit start - Capture drops for death event if (this instanceof net.minecraft.world.entity.LivingEntity && !((net.minecraft.world.entity.LivingEntity) this).forceDrops) {