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

@@ -13,17 +13,16 @@
public class ItemLeash extends Item {
public ItemLeash(Item.Info item_info) {
@@ -35,7 +41,7 @@
@@ -35,14 +41,14 @@
EntityHuman entityhuman = itemactioncontext.getPlayer();
if (!world.isClientSide && entityhuman != null) {
- bindPlayerMobs(entityhuman, world, blockposition);
+ bindPlayerMobs(entityhuman, world, blockposition, itemactioncontext.getHand()); // CraftBukkit - Pass hand
- return bindPlayerMobs(entityhuman, world, blockposition);
+ return bindPlayerMobs(entityhuman, world, blockposition, itemactioncontext.getHand()); // CraftBukkit - Pass hand
}
return EnumInteractionResult.sidedSuccess(world.isClientSide);
@@ -44,7 +50,7 @@
}
return EnumInteractionResult.PASS;
}
- public static EnumInteractionResult bindPlayerMobs(EntityHuman entityhuman, World world, BlockPosition blockposition) {
@@ -31,7 +30,7 @@
EntityLeash entityleash = null;
List<Leashable> list = leashableInArea(world, blockposition, (leashable) -> {
return leashable.getLeashHolder() == entityhuman;
@@ -52,22 +58,55 @@
@@ -50,22 +56,55 @@
Leashable leashable;
@@ -68,7 +67,7 @@
if (!list.isEmpty()) {
world.gameEvent((Holder) GameEvent.BLOCK_ATTACH, blockposition, GameEvent.a.of((Entity) entityhuman));
return EnumInteractionResult.SUCCESS;
return EnumInteractionResult.SUCCESS_SERVER;
} else {
+ // CraftBukkit start- remove leash if we do not leash any entity because of the cancelled event
+ if (entityleash != null) {