PaperMC/patches/server/0469-Configurable-max-leash-distance.patch

33 lines
1.9 KiB
Diff
Raw Normal View History

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-12-03 19:54:10 +01:00
index 4692704b58d1b73a45f1d587782dc706da94a6e6..5e67402340a81a965b0b3af88307d36500c2dc6b 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
2024-12-03 19:54:10 +01:00
@@ -201,7 +201,7 @@ public interface Leashable {
2024-06-13 22:57:13 +02:00
return;
}
- if ((double) f > 10.0D) {
+ 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);
diff --git a/src/main/java/net/minecraft/world/entity/TamableAnimal.java b/src/main/java/net/minecraft/world/entity/TamableAnimal.java
2024-12-03 19:54:10 +01:00
index 144ef3cc71bb265646e48f3a5f10d971b5768154..9c6e2124da7c2358d2d524c52d3e77422f15f6e5 100644
--- a/src/main/java/net/minecraft/world/entity/TamableAnimal.java
+++ b/src/main/java/net/minecraft/world/entity/TamableAnimal.java
2024-12-03 19:54:10 +01:00
@@ -101,7 +101,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
2024-12-03 19:54:10 +01:00
this.dropLeash();
}