mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-20 18:07:43 +01:00
61 lines
3.7 KiB
Diff
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 032bc56ad7700d1ba79efbce32654c57a9434711..1f6183c4fe55168c5a234c6258fb46d49cee3b2d 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -234,6 +234,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
|
|
public boolean horizontalCollision;
|
|
public boolean verticalCollision;
|
|
public boolean minorHorizontalCollision;
|
|
+ public boolean collidingWithWorldBorder; // Purpur
|
|
public boolean hurtMarked;
|
|
protected Vec3 stuckSpeedMultiplier;
|
|
@Nullable
|
|
@@ -1314,7 +1315,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
|
|
io.papermc.paper.util.CollisionUtil.getCollisions(world, this, collisionBox, potentialCollisions, false, true,
|
|
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 f85daf21ae3d77d2d56c131c6df9aa0715a306ca..6ef3cf19e5374631602e68d15ad431fc1a747ea5 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/Spider.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Spider.java
|
|
@@ -113,7 +113,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 7134fbde05d461cb130b19fbb5917ba9a96293bf..042d93e68f883eda989a08bcffe7be0ff61c8d9b 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -2359,6 +2359,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);
|
|
@@ -2370,6 +2371,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;
|