From 5717b84708ea8eaf5df9b05cd7b94dcc368093c9 Mon Sep 17 00:00:00 2001 From: Noah van der Aa Date: Fri, 23 Dec 2022 17:51:24 +0100 Subject: [PATCH] Add config option for spider worldborder climbing (#6448) Co-authored-by: BillyGalbreath --- patches/server/0004-Paper-config-files.patch | 5 ++- ...tion-for-spider-worldborder-climbing.patch | 40 +++++++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 patches/server/0951-Add-config-option-for-spider-worldborder-climbing.patch diff --git a/patches/server/0004-Paper-config-files.patch b/patches/server/0004-Paper-config-files.patch index 9ab5c1e13c..07fac6871e 100644 --- a/patches/server/0004-Paper-config-files.patch +++ b/patches/server/0004-Paper-config-files.patch @@ -1444,10 +1444,10 @@ index 0000000000000000000000000000000000000000..1bb16fc7598cd53e822d84b69d6a9727 +} diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java new file mode 100644 -index 0000000000000000000000000000000000000000..7e1add0f18da3ac2d93b084979d419cf45d2bca3 +index 0000000000000000000000000000000000000000..2e9590c73d867c3ebb42f695df4c796a0f477452 --- /dev/null +++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java -@@ -0,0 +1,471 @@ +@@ -0,0 +1,472 @@ +package io.papermc.paper.configuration; + +import com.google.common.collect.HashBasedTable; @@ -1655,6 +1655,7 @@ index 0000000000000000000000000000000000000000..7e1add0f18da3ac2d93b084979d419cf + public boolean zombiesTargetTurtleEggs = true; + public boolean piglinsGuardChests = true; + public double babyZombieMovementModifier = 0.5; ++ public boolean allowSpiderWorldBorderClimbing = true; + public DoorBreakingDifficulty doorBreakingDifficulty; + + public class DoorBreakingDifficulty extends ConfigurationPart { // TODO convert to map at some point diff --git a/patches/server/0951-Add-config-option-for-spider-worldborder-climbing.patch b/patches/server/0951-Add-config-option-for-spider-worldborder-climbing.patch new file mode 100644 index 0000000000..03220d30d8 --- /dev/null +++ b/patches/server/0951-Add-config-option-for-spider-worldborder-climbing.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +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 be54a70b47433c2abaeb8632ffe55d0762f619d6..91b6e1fa1a6f03ea50c703925dd2f5795bcecd5f 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -397,6 +397,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + @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(); +@@ -1391,7 +1392,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + io.papermc.paper.util.CollisionUtil.getCollisions(world, this, collisionBox, potentialCollisions, false, this.level.paperConfig().chunks.preventMovingIntoUnloadedChunks, + false, false, 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 + io.papermc.paper.util.CollisionUtil.addBoxesToIfIntersects(world.getWorldBorder().getCollisionShape(), collisionBox, potentialCollisions); + } + +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 001f6cf2ea3d664864f444a92dd71d069b9a38f5..d786b8b8c9d478504f74e65c3bc7ed3e9884d003 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/Spider.java ++++ b/src/main/java/net/minecraft/world/entity/monster/Spider.java +@@ -84,7 +84,7 @@ public class Spider extends Monster { + public void tick() { + super.tick(); + if (!this.level.isClientSide) { +- this.setClimbing(this.horizontalCollision); ++ this.setClimbing(this.horizontalCollision && (this.level.paperConfig().entities.behavior.allowSpiderWorldBorderClimbing || !collidingWithWorldBorder)); // Paper + } + + }