diff options
Diffstat (limited to 'nms-patches/ItemBucket.patch')
-rw-r--r-- | nms-patches/ItemBucket.patch | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/nms-patches/ItemBucket.patch b/nms-patches/ItemBucket.patch index 4a89f897..e486ce13 100644 --- a/nms-patches/ItemBucket.patch +++ b/nms-patches/ItemBucket.patch @@ -13,7 +13,7 @@ public class ItemBucket extends Item { -@@ -33,15 +39,29 @@ +@@ -34,15 +40,29 @@ Material material = iblockdata.getMaterial(); if (material == Material.WATER && ((Integer) iblockdata.get(BlockFluids.LEVEL)).intValue() == 0) { @@ -26,9 +26,9 @@ + // CraftBukkit end world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 11); entityhuman.b(StatisticList.b((Item) this)); - entityhuman.a(SoundEffects.N, 1.0F, 1.0F); + entityhuman.a(SoundEffects.P, 1.0F, 1.0F); - return new InteractionResultWrapper(EnumInteractionResult.SUCCESS, this.a(itemstack, entityhuman, Items.WATER_BUCKET)); -+ return new InteractionResultWrapper(EnumInteractionResult.SUCCESS, this.a(itemstack, entityhuman, Items.WATER_BUCKET, event.getItemStack())); // CraftBUkkit ++ return new InteractionResultWrapper(EnumInteractionResult.SUCCESS, this.a(itemstack, entityhuman, Items.WATER_BUCKET, event.getItemStack())); // CraftBukkit } else if (material == Material.LAVA && ((Integer) iblockdata.get(BlockFluids.LEVEL)).intValue() == 0) { + // CraftBukkit start + PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman, blockposition.getX(), blockposition.getY(), blockposition.getZ(), null, itemstack, Items.LAVA_BUCKET); @@ -37,7 +37,7 @@ + return new InteractionResultWrapper(EnumInteractionResult.FAIL, itemstack); + } + // CraftBukkit end - entityhuman.a(SoundEffects.O, 1.0F, 1.0F); + entityhuman.a(SoundEffects.Q, 1.0F, 1.0F); world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 11); entityhuman.b(StatisticList.b((Item) this)); - return new InteractionResultWrapper(EnumInteractionResult.SUCCESS, this.a(itemstack, entityhuman, Items.LAVA_BUCKET)); @@ -45,7 +45,7 @@ } else { return new InteractionResultWrapper(EnumInteractionResult.FAIL, itemstack); } -@@ -52,7 +72,7 @@ +@@ -53,7 +73,7 @@ if (!entityhuman.a(blockposition1, movingobjectposition.direction, itemstack)) { return new InteractionResultWrapper(EnumInteractionResult.FAIL, itemstack); @@ -54,7 +54,7 @@ entityhuman.b(StatisticList.b((Item) this)); return !entityhuman.abilities.canInstantlyBuild ? new InteractionResultWrapper(EnumInteractionResult.SUCCESS, new ItemStack(Items.BUCKET)) : new InteractionResultWrapper(EnumInteractionResult.SUCCESS, itemstack); } else { -@@ -62,21 +82,28 @@ +@@ -63,16 +83,19 @@ } } @@ -63,17 +63,22 @@ + private ItemStack a(ItemStack itemstack, EntityHuman entityhuman, Item item, org.bukkit.inventory.ItemStack result) { if (entityhuman.abilities.canInstantlyBuild) { return itemstack; - } else if (--itemstack.count <= 0) { -- return new ItemStack(item); -+ return CraftItemStack.asNMSCopy(result); // CraftBukkit } else { -- if (!entityhuman.inventory.pickup(new ItemStack(item))) { -- entityhuman.drop(new ItemStack(item), false); -+ if (!entityhuman.inventory.pickup(CraftItemStack.asNMSCopy(result))) { -+ entityhuman.drop(CraftItemStack.asNMSCopy(result), false); - } + itemstack.subtract(1); + if (itemstack.isEmpty()) { +- return new ItemStack(item); ++ // CraftBukkit start ++ return CraftItemStack.asNMSCopy(result); + } else { +- if (!entityhuman.inventory.pickup(new ItemStack(item))) { +- entityhuman.drop(new ItemStack(item), false); ++ if (!entityhuman.inventory.pickup(CraftItemStack.asNMSCopy(result))) { ++ entityhuman.drop(CraftItemStack.asNMSCopy(result), false); ++ // CraftBukkit end + } - return itemstack; + return itemstack; +@@ -80,7 +103,13 @@ } } @@ -87,7 +92,7 @@ if (this.a == Blocks.AIR) { return false; } else { -@@ -88,6 +115,15 @@ +@@ -92,6 +121,15 @@ if (!world.isEmpty(blockposition) && !flag && !flag1) { return false; } else { |