Co-authored-by: Bjarne Koll <git@lynxplay.dev>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
Co-authored-by: MiniDigger | Martin <admin@minidigger.dev>
Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>
Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Co-authored-by: Shane Freeder <theboyetronic@gmail.com>
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
Co-authored-by: Tamion <70228790+notTamion@users.noreply.github.com>
Co-authored-by: Warrior <50800980+Warriorrrr@users.noreply.github.com>
This commit is contained in:
Nassim Jahnke
2025-04-12 17:26:44 +02:00
parent 0767902699
commit f00727c57e
2092 changed files with 50551 additions and 48729 deletions

View File

@@ -1,33 +1,18 @@
--- a/net/minecraft/world/entity/Leashable.java
+++ b/net/minecraft/world/entity/Leashable.java
@@ -56,7 +_,13 @@
@Nullable
private static Leashable.LeashData readLeashDataInternal(CompoundTag tag) {
if (tag.contains("leash", 10)) {
- return new Leashable.LeashData(Either.left(tag.getCompound("leash").getUUID("UUID")));
+ // Paper start
+ final CompoundTag leashTag = tag.getCompound("leash");
+ if (!leashTag.hasUUID("UUID")) {
+ return null;
+ }
+ return new Leashable.LeashData(Either.left(leashTag.getUUID("UUID")));
+ // Paper end
} else {
if (tag.contains("leash", 11)) {
Either<UUID, BlockPos> either = NbtUtils.readBlockPos(tag, "leash").<Either<UUID, BlockPos>>map(Either::right).orElse(null);
@@ -72,6 +_,11 @@
@@ -56,6 +_,11 @@
}
default void writeLeashData(CompoundTag tag, @Nullable Leashable.LeashData leashData) {
if (leashData != null) {
Either<UUID, BlockPos> either = leashData.delayedLeashInfo;
+ // CraftBukkit start - SPIGOT-7487: Don't save (and possible drop) leash, when the holder was removed by a plugin
+ if (leashData.leashHolder != null && leashData.leashHolder.pluginRemoved) {
+ return;
+ }
+ // CraftBukkit end
if (leashData.leashHolder instanceof LeashFenceKnotEntity leashFenceKnotEntity) {
either = Either.right(leashFenceKnotEntity.getPos());
} else if (leashData.leashHolder != null) {
@@ -104,7 +_,9 @@
+ // CraftBukkit start - SPIGOT-7487: Don't save (and possible drop) leash, when the holder was removed by a plugin
+ if (leashData != null && leashData.leashHolder != null && leashData.leashHolder.pluginRemoved) {
+ return;
+ }
+ // CraftBukkit end
tag.storeNullable("leash", Leashable.LeashData.CODEC, leashData);
}
@@ -75,7 +_,9 @@
}
if (entity.tickCount > 100) {
@@ -37,7 +22,7 @@
entity.setLeashData(null);
}
}
@@ -128,7 +_,9 @@
@@ -99,7 +_,9 @@
entity.onLeashRemoved();
if (entity.level() instanceof ServerLevel serverLevel) {
if (dropItem) {
@@ -47,7 +32,7 @@
}
if (broadcastPacket) {
@@ -146,7 +_,15 @@
@@ -117,7 +_,15 @@
if (leashData != null && leashData.leashHolder != null) {
if (!entity.isAlive() || !leashData.leashHolder.isAlive()) {
@@ -64,7 +49,7 @@
entity.dropLeash();
} else {
entity.removeLeash();
@@ -160,7 +_,7 @@
@@ -131,7 +_,7 @@
return;
}
@@ -73,7 +58,7 @@
entity.leashTooFarBehaviour();
} else if (f > 6.0) {
entity.elasticRangeLeashBehaviour(leashHolder, f);
@@ -177,7 +_,21 @@
@@ -148,7 +_,21 @@
}
default void leashTooFarBehaviour() {