Update to Minecraft 1.21.4

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2024-12-04 03:20:00 +11:00
parent 267ae64dd6
commit 5381ea78f7
125 changed files with 1383 additions and 1093 deletions

View File

@@ -20,8 +20,8 @@
+ dropLeash((Entity & Leashable) this, false, false); // CraftBukkit - decompile error
}
@Nullable
@@ -54,7 +59,7 @@
default void readLeashData(NBTTagCompound nbttagcompound) {
@@ -64,7 +69,7 @@
return new Leashable.a(Either.left(nbttagcompound.getCompound("leash").getUUID("UUID")));
} else {
if (nbttagcompound.contains("leash", 11)) {
@@ -30,7 +30,7 @@
if (either != null) {
return new Leashable.a(either);
@@ -69,6 +74,11 @@
@@ -79,6 +84,11 @@
if (leashable_a != null) {
Either<UUID, BlockPosition> either = leashable_a.delayedLeashInfo;
Entity entity = leashable_a.leashHolder;
@@ -42,7 +42,7 @@
if (entity instanceof EntityLeash) {
EntityLeash entityleash = (EntityLeash) entity;
@@ -111,7 +121,9 @@
@@ -121,7 +131,9 @@
}
if (e0.tickCount > 100) {
@@ -52,16 +52,21 @@
((Leashable) e0).setLeashData((Leashable.a) null);
}
}
@@ -120,7 +132,7 @@
@@ -130,11 +142,11 @@
}
default void dropLeash(boolean flag, boolean flag1) {
- dropLeash((Entity) this, flag, flag1);
+ dropLeash((Entity & Leashable) this, flag, flag1); // CraftBukkit - decompile error
default void dropLeash() {
- dropLeash((Entity) this, true, true);
+ dropLeash((Entity & Leashable) this, true, true); // CraftBukkit - decompile error
}
private static <E extends Entity & Leashable> void dropLeash(E e0, boolean flag, boolean flag1) {
@@ -134,7 +146,9 @@
default void removeLeash() {
- dropLeash((Entity) this, true, false);
+ dropLeash((Entity & Leashable) this, true, false); // CraftBukkit - decompile error
}
default void onLeashRemoved() {}
@@ -151,7 +163,9 @@
WorldServer worldserver = (WorldServer) world;
if (flag1) {
@@ -71,17 +76,17 @@
}
if (flag) {
@@ -154,7 +168,8 @@
@@ -171,7 +185,8 @@
if (leashable_a != null && leashable_a.leashHolder != null) {
if (!e0.isAlive() || !leashable_a.leashHolder.isAlive()) {
- dropLeash(e0, true, worldserver.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS));
- if (worldserver.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
+ worldserver.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(e0.getBukkitEntity(), (!e0.isAlive()) ? UnleashReason.PLAYER_UNLEASH : UnleashReason.HOLDER_GONE)); // CraftBukkit
+ dropLeash(e0, true, worldserver.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS) && !e0.pluginRemoved); // CraftBukkit - SPIGOT-7487: Don't drop leash, when the holder was removed by a plugin
}
Entity entity = ((Leashable) e0).getLeashHolder();
@@ -184,13 +199,18 @@
+ if (worldserver.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS) && !e0.pluginRemoved) { // CraftBukkit - SPIGOT-7487: Don't drop leash, when the holder was removed by a plugin
((Leashable) e0).dropLeash();
} else {
((Leashable) e0).removeLeash();
@@ -205,13 +220,18 @@
}
default void leashTooFarBehaviour() {
@@ -90,7 +95,7 @@
+ entity.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(entity.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE));
+ }
+ // CraftBukkit end
this.dropLeash(true, true);
this.dropLeash();
}
default void closeRangeLeashBehaviour(Entity entity) {}
@@ -101,7 +106,7 @@
}
private static <E extends Entity & Leashable> void legacyElasticRangeLeashBehaviour(E e0, Entity entity, float f) {
@@ -202,7 +222,7 @@
@@ -223,7 +243,7 @@
}
default void setLeashedTo(Entity entity, boolean flag) {
@@ -110,7 +115,7 @@
}
private static <E extends Entity & Leashable> void setLeashedTo(E e0, Entity entity, boolean flag) {
@@ -233,7 +253,7 @@
@@ -254,7 +274,7 @@
@Nullable
default Entity getLeashHolder() {