Files
Shiroha/camellia-server/minecraft-patches/features/0011-Fix-off-region-leashing.patch
T

36 lines
1.7 KiB
Diff
Raw Normal View History

2026-07-09 00:03:09 +08:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <mrhua269@gmail.com>
Date: Wed, 8 Jul 2026 21:13:39 +0800
Subject: [PATCH] Fix off region leashing
diff --git a/net/minecraft/world/entity/Leashable.java b/net/minecraft/world/entity/Leashable.java
index 98034a4c96bf2972316078d3b3a49140921aab50..ba4ee88ada40997759f4650b8d4aa9ecce0fab1d 100644
--- a/net/minecraft/world/entity/Leashable.java
+++ b/net/minecraft/world/entity/Leashable.java
@@ -95,10 +95,24 @@ public interface Leashable {
if (leashUuid.isPresent()) {
Entity leasher = serverLevel.getEntity(leashUuid.get());
if (leasher != null) {
+ // Camellia start - Fix off region leashing
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(leasher)) {
+ entity.spawnAtLocation(serverLevel, Items.LEAD);
+ entity.setLeashData(null);
+ return;
+ }
+ // Camellia end
setLeashedTo(entity, leasher, true);
return;
}
} else if (pos.isPresent()) {
+ // Camellia start - Fix off region leashing
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(serverLevel, pos.get())) {
+ entity.spawnAtLocation(serverLevel, Items.LEAD);
+ entity.setLeashData(null);
+ return;
+ }
+ // Camellia end
setLeashedTo(entity, LeashFenceKnotEntity.getOrCreateKnot(serverLevel, pos.get()), true);
return;
}