From cd4969468cfb858f9cd9073143e63d080504b682 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Sun, 3 Jan 2021 21:04:03 -0800 Subject: [PATCH] Configurable max leash distance --- .../net/minecraft/world/entity/Leashable.java.patch | 9 +++++++++ .../net/minecraft/world/entity/TamableAnimal.java.patch | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/paper-server/patches/sources/net/minecraft/world/entity/Leashable.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/Leashable.java.patch index 109ed9f981..559a82e1d9 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/Leashable.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/Leashable.java.patch @@ -85,6 +85,15 @@ ((Leashable) entity).dropLeash(); } else { ((Leashable) entity).removeLeash(); +@@ -187,7 +201,7 @@ + return; + } + +- if ((double) f > 10.0D) { ++ if ((double) f > entity.level().paperConfig().misc.maxLeashDistance.or(LEASH_TOO_FAR_DIST)) { // Paper - Configurable max leash distance + ((Leashable) entity).leashTooFarBehaviour(); + } else if ((double) f > 6.0D) { + ((Leashable) entity).elasticRangeLeashBehaviour(entity1, f); @@ -205,13 +219,18 @@ } diff --git a/paper-server/patches/sources/net/minecraft/world/entity/TamableAnimal.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/TamableAnimal.java.patch index 7a3fb81abc..a18f72d648 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/TamableAnimal.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/TamableAnimal.java.patch @@ -12,6 +12,15 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity { +@@ -96,7 +101,7 @@ + @Override + public boolean handleLeashAtDistance(Entity leashHolder, float distance) { + if (this.isInSittingPose()) { +- if (distance > 10.0F) { ++ if (distance > (float) this.level().paperConfig().misc.maxLeashDistance.or(Leashable.LEASH_TOO_FAR_DIST)) { // Paper - Configurable max leash distance + this.dropLeash(); + } + @@ -295,7 +300,14 @@ if (!this.canTeleportTo(new BlockPos(x, y, z))) { return false;