Update to Minecraft 1.21.2

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2024-10-23 02:15:00 +11:00
parent 2c4beb962b
commit d3a23f42c3
522 changed files with 8501 additions and 6477 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/Leashable.java
+++ b/net/minecraft/world/entity/Leashable.java
@@ -15,6 +15,11 @@
@@ -16,6 +16,11 @@
import net.minecraft.world.level.IMaterial;
import net.minecraft.world.level.World;
@@ -12,7 +12,7 @@
public interface Leashable {
String LEASH_TAG = "leash";
@@ -44,7 +49,7 @@
@@ -45,7 +50,7 @@
default void setDelayedLeashHolderId(int i) {
this.setLeashData(new Leashable.a(i));
@@ -21,7 +21,7 @@
}
@Nullable
@@ -53,7 +58,7 @@
@@ -54,7 +59,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);
@@ -68,6 +73,11 @@
@@ -69,6 +74,11 @@
if (leashable_a != null) {
Either<UUID, BlockPosition> either = leashable_a.delayedLeashInfo;
Entity entity = leashable_a.leashHolder;
@@ -42,17 +42,17 @@
if (entity instanceof EntityLeash) {
EntityLeash entityleash = (EntityLeash) entity;
@@ -110,7 +120,9 @@
@@ -111,7 +121,9 @@
}
if (e0.tickCount > 100) {
+ e0.forceDrops = true; // CraftBukkit
e0.spawnAtLocation((IMaterial) Items.LEAD);
e0.spawnAtLocation(worldserver, (IMaterial) Items.LEAD);
+ e0.forceDrops = false; // CraftBukkit
((Leashable) e0).setLeashData((Leashable.a) null);
}
}
@@ -119,7 +131,7 @@
@@ -120,7 +132,7 @@
}
default void dropLeash(boolean flag, boolean flag1) {
@@ -61,27 +61,27 @@
}
private static <E extends Entity & Leashable> void dropLeash(E e0, boolean flag, boolean flag1) {
@@ -128,7 +140,9 @@
if (leashable_a != null && leashable_a.leashHolder != null) {
((Leashable) e0).setLeashData((Leashable.a) null);
if (!e0.level().isClientSide && flag1) {
+ e0.forceDrops = true; // CraftBukkit
e0.spawnAtLocation((IMaterial) Items.LEAD);
+ e0.forceDrops = false; // CraftBukkit
}
@@ -134,7 +146,9 @@
WorldServer worldserver = (WorldServer) world;
if (flag) {
@@ -153,7 +167,8 @@
if (flag1) {
+ e0.forceDrops = true; // CraftBukkit
e0.spawnAtLocation(worldserver, (IMaterial) Items.LEAD);
+ e0.forceDrops = false; // CraftBukkit
}
if (flag) {
@@ -154,7 +168,8 @@
if (leashable_a != null && leashable_a.leashHolder != null) {
if (!e0.isAlive() || !leashable_a.leashHolder.isAlive()) {
- dropLeash(e0, true, true);
+ e0.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(e0.getBukkitEntity(), (!e0.isAlive()) ? UnleashReason.PLAYER_UNLEASH : UnleashReason.HOLDER_GONE)); // CraftBukkit
+ dropLeash(e0, true, !e0.pluginRemoved); // CraftBukkit - SPIGOT-7487: Don't drop leash, when the holder was removed by a plugin
- dropLeash(e0, true, 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();
@@ -183,13 +198,18 @@
@@ -184,13 +199,18 @@
}
default void leashTooFarBehaviour() {
@@ -101,7 +101,7 @@
}
private static <E extends Entity & Leashable> void legacyElasticRangeLeashBehaviour(E e0, Entity entity, float f) {
@@ -201,7 +221,7 @@
@@ -202,7 +222,7 @@
}
default void setLeashedTo(Entity entity, boolean flag) {
@@ -110,7 +110,7 @@
}
private static <E extends Entity & Leashable> void setLeashedTo(E e0, Entity entity, boolean flag) {
@@ -232,7 +252,7 @@
@@ -233,7 +253,7 @@
@Nullable
default Entity getLeashHolder() {