@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user