Add config option for spider worldborder climbing (#6448)

Co-authored-by: BillyGalbreath <blake.galbreath@gmail.com>
This commit is contained in:
Noah van der Aa 2022-12-23 17:51:24 +01:00 committed by GitHub
parent c59922d94e
commit 5717b84708
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 2 deletions

View File

@ -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 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 new file mode 100644
index 0000000000000000000000000000000000000000..7e1add0f18da3ac2d93b084979d419cf45d2bca3 index 0000000000000000000000000000000000000000..2e9590c73d867c3ebb42f695df4c796a0f477452
--- /dev/null --- /dev/null
+++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
@@ -0,0 +1,471 @@ @@ -0,0 +1,472 @@
+package io.papermc.paper.configuration; +package io.papermc.paper.configuration;
+ +
+import com.google.common.collect.HashBasedTable; +import com.google.common.collect.HashBasedTable;
@ -1655,6 +1655,7 @@ index 0000000000000000000000000000000000000000..7e1add0f18da3ac2d93b084979d419cf
+ public boolean zombiesTargetTurtleEggs = true; + public boolean zombiesTargetTurtleEggs = true;
+ public boolean piglinsGuardChests = true; + public boolean piglinsGuardChests = true;
+ public double babyZombieMovementModifier = 0.5; + public double babyZombieMovementModifier = 0.5;
+ public boolean allowSpiderWorldBorderClimbing = true;
+ public DoorBreakingDifficulty doorBreakingDifficulty; + public DoorBreakingDifficulty doorBreakingDifficulty;
+ +
+ public class DoorBreakingDifficulty extends ConfigurationPart { // TODO convert to map at some point + public class DoorBreakingDifficulty extends ConfigurationPart { // TODO convert to map at some point

View File

@ -0,0 +1,40 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <blake.galbreath@gmail.com>
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
}
}