diff --git a/patches/server/Configurable-max-leash-distance.patch b/patches/server/Configurable-max-leash-distance.patch index 9109d4354b..14fe9099ac 100644 --- a/patches/server/Configurable-max-leash-distance.patch +++ b/patches/server/Configurable-max-leash-distance.patch @@ -13,7 +13,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } - if ((double) f > 10.0D) { -+ if ((double) f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper - Configurable max leash distance ++ 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); +diff --git a/src/main/java/net/minecraft/world/entity/TamableAnimal.java b/src/main/java/net/minecraft/world/entity/TamableAnimal.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/TamableAnimal.java ++++ b/src/main/java/net/minecraft/world/entity/TamableAnimal.java +@@ -0,0 +0,0 @@ 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); + } + diff --git a/patches/server/Expand-EntityUnleashEvent.patch b/patches/server/Expand-EntityUnleashEvent.patch index d25ae9f802..f5bd7efda3 100644 --- a/patches/server/Expand-EntityUnleashEvent.patch +++ b/patches/server/Expand-EntityUnleashEvent.patch @@ -27,11 +27,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } @@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + protected void removeAfterChangingDimensions() { this.setRemoved(Entity.RemovalReason.CHANGED_DIMENSION, null); // CraftBukkit - add Bukkit remove cause - if (this instanceof Leashable leashable) { +- if (this instanceof Leashable leashable) { - this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit - leashable.dropLeash(true, false); ++ if (this instanceof Leashable leashable && leashable.isLeashed()) { // Paper - only call if it is leashed + // Paper start - Expand EntityUnleashEvent + final EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN, false); // CraftBukkit + event.callEvent(); @@ -95,6 +97,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } return flag1; +diff --git a/src/main/java/net/minecraft/world/entity/TamableAnimal.java b/src/main/java/net/minecraft/world/entity/TamableAnimal.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/TamableAnimal.java ++++ b/src/main/java/net/minecraft/world/entity/TamableAnimal.java +@@ -0,0 +0,0 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity { + public boolean handleLeashAtDistance(Entity leashHolder, float distance) { + if (this.isInSittingPose()) { + if (distance > (float) this.level().paperConfig().misc.maxLeashDistance.or(Leashable.LEASH_TOO_FAR_DIST)) { // Paper - Configurable max leash distance +- this.dropLeash(true, true); ++ // Paper start - Expand EntityUnleashEvent ++ org.bukkit.event.entity.EntityUnleashEvent event = new org.bukkit.event.entity.EntityUnleashEvent(this.getBukkitEntity(), org.bukkit.event.entity.EntityUnleashEvent.UnleashReason.DISTANCE, true); ++ if (!event.callEvent()) return false; ++ this.dropLeash(true, event.isDropLeash()); ++ // Paper end - Expand EntityUnleashEvent + } + + return false; diff --git a/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java b/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java diff --git a/patches/server/Fix-item-duplication-and-teleport-issues.patch b/patches/server/Fix-item-duplication-and-teleport-issues.patch index 88c5b7a0da..6d7e349aa4 100644 --- a/patches/server/Fix-item-duplication-and-teleport-issues.patch +++ b/patches/server/Fix-item-duplication-and-teleport-issues.patch @@ -52,8 +52,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (entity2 != null) { if (this != entity2) { + // Paper start - Fix item duplication and teleport issues -+ if (this instanceof Mob) { -+ ((Mob) this).dropLeash(true, true); // Paper drop lead ++ if (this instanceof Leashable leashable) { ++ leashable.dropLeash(true, true); // Paper drop lead + } + // Paper end - Fix item duplication and teleport issues entity2.restoreFrom(this); diff --git a/patches/server/Paper-config-files.patch b/patches/server/Paper-config-files.patch index 90a92bdcd2..9a44c83528 100644 --- a/patches/server/Paper-config-files.patch +++ b/patches/server/Paper-config-files.patch @@ -1031,6 +1031,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + .register(MapSerializer.TYPE, new MapSerializer(false)) + .register(new EnumValueSerializer()) + .register(new ComponentSerializer()) ++ .register(IntOr.Default.SERIALIZER) ++ .register(IntOr.Disabled.SERIALIZER) ++ .register(DoubleOr.Default.SERIALIZER) ++ .register(DoubleOr.Disabled.SERIALIZER) ++ .register(BooleanOrDefault.SERIALIZER) ++ .register(Duration.SERIALIZER) ++ .register(DurationOrDisabled.SERIALIZER) ++ .register(NbtPathSerializer.SERIALIZER) + ); + } + @@ -1054,9 +1062,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + .header(GLOBAL_HEADER) + .serializers(builder -> builder + .register(new PacketClassSerializer()) -+ .register(IntOr.Disabled.SERIALIZER) -+ .register(IntOr.Default.SERIALIZER) -+ .register(DoubleOr.Default.SERIALIZER) + ); + } + @@ -1100,14 +1105,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + .register(new TypeToken