2024-06-13 22:57:13 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sun, 3 Jan 2021 21:04:03 -0800
Subject: [PATCH] Configurable max leash distance
diff --git a/src/main/java/net/minecraft/world/entity/Leashable.java b/src/main/java/net/minecraft/world/entity/Leashable.java
2024-08-25 23:32:32 +02:00
index 1f2d04a456c383815b0c5ef331471593556fd128..5c51dd5229689cba459655d488aee59bd159a414 100644
2024-06-13 22:57:13 +02:00
--- a/src/main/java/net/minecraft/world/entity/Leashable.java
+++ b/src/main/java/net/minecraft/world/entity/Leashable.java
@@ -179,7 +179,7 @@ public interface Leashable {
return;
}
- if ((double) f > 10.0D) {
2024-08-25 23:32:32 +02:00
+ if ((double) f > entity.level().paperConfig().misc.maxLeashDistance.or(LEASH_TOO_FAR_DIST)) { // Paper - Configurable max leash distance
2024-06-13 22:57:13 +02:00
((Leashable) entity).leashTooFarBehaviour();
} else if ((double) f > 6.0D) {
((Leashable) entity).elasticRangeLeashBehaviour(entity1, f);
2024-08-25 23:32:32 +02:00
diff --git a/src/main/java/net/minecraft/world/entity/TamableAnimal.java b/src/main/java/net/minecraft/world/entity/TamableAnimal.java
index f2d311a5450eb684603580bbf7e9e7fc73fc2f5c..bf2c9134c7d9d5926add36b55e3cfea79e8c8243 100644
--- a/src/main/java/net/minecraft/world/entity/TamableAnimal.java
+++ b/src/main/java/net/minecraft/world/entity/TamableAnimal.java
@@ -97,7 +97,7 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity {
@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(true, true);
}