Files
Purpur/patches/server/0243-Option-to-prevent-spiders-from-climbing-world-border.patch
BillyGalbreath 50687db565 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@b097a24 Expose isUnderWater to Entity (#8454)
PaperMC/Paper@6b26cfc Add missing Entity + Projectile API (#7632)
PaperMC/Paper@de2d2d4 Add PlayerInventorySlotChangeEvent (#7321)
PaperMC/Paper@f7c8d79 Fix stacktrace in server tests
PaperMC/Paper@b9cf1ac Fix a classloading issue in tests (#8459)
PaperMC/Paper@7fe34e9 Make CraftMinecartTNT public
PaperMC/Paper@514a606 Elder Guardian appearance API (#8455)
PaperMC/Paper@2094011 Update settings directory path in exceptions (#7968)
PaperMC/Paper@0bdf997 Avoid cycle deprecation (#8466)
PaperMC/Paper@eb68bd4 Allow changing bed's 'occupied' property (#8458)
2022-10-15 12:51:22 -05:00

61 lines
3.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <blake.galbreath@gmail.com>
Date: Tue, 28 Dec 2021 10:11:31 -0600
Subject: [PATCH] Option to prevent spiders from climbing world border
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index de68663faebbfc019025d83d70b825ed6a6b8f11..c0ad8f069d78719e01d92c42a190a4e57d6b6d67 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -304,6 +304,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
public boolean verticalCollision;
public boolean verticalCollisionBelow;
public boolean minorHorizontalCollision;
+ public boolean collidingWithWorldBorder; // Purpur
public boolean hurtMarked;
protected Vec3 stuckSpeedMultiplier;
@Nullable
@@ -1416,7 +1417,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 (this.collidingWithWorldBorder = io.papermc.paper.util.CollisionUtil.isCollidingWithBorderEdge(world.getWorldBorder(), collisionBox)) { // Purpur
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 bdd4fc3072f7a5ea504ba35f6a08ae971e83b69f..b9ac8cefefe1f47548166330b7c889dfbc05e583 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Spider.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Spider.java
@@ -118,7 +118,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.purpurConfig.spiderCanClimbWorldBorder || !this.collidingWithWorldBorder)); // Purpur
}
}
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 229b4c97f2b05660a5564e4d3ee114495e056535..026dcf93405f70e5249bff9bd574aa195903e706 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -2458,6 +2458,7 @@ public class PurpurWorldConfig {
public double spiderMaxHealth = 16.0D;
public boolean spiderTakeDamageFromWater = false;
public boolean spiderAlwaysDropExp = false;
+ public boolean spiderCanClimbWorldBorder = true;
private void spiderSettings() {
spiderRidable = getBoolean("mobs.spider.ridable", spiderRidable);
spiderRidableInWater = getBoolean("mobs.spider.ridable-in-water", spiderRidableInWater);
@@ -2470,6 +2471,7 @@ public class PurpurWorldConfig {
spiderMaxHealth = getDouble("mobs.spider.attributes.max_health", spiderMaxHealth);
spiderTakeDamageFromWater = getBoolean("mobs.spider.takes-damage-from-water", spiderTakeDamageFromWater);
spiderAlwaysDropExp = getBoolean("mobs.spider.always-drop-exp", spiderAlwaysDropExp);
+ spiderCanClimbWorldBorder = getBoolean("mobs.spider.can-climb-world-border", spiderCanClimbWorldBorder);
}
public boolean strayRidable = false;