diff options
Diffstat (limited to 'nms-patches/EntityCow.patch')
-rw-r--r-- | nms-patches/EntityCow.patch | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/nms-patches/EntityCow.patch b/nms-patches/EntityCow.patch index 1593b85b..c231dfd8 100644 --- a/nms-patches/EntityCow.patch +++ b/nms-patches/EntityCow.patch @@ -11,10 +11,10 @@ public class EntityCow extends EntityAnimal { -@@ -57,12 +61,22 @@ +@@ -59,13 +63,23 @@ + ItemStack itemstack = entityhuman.b(enumhand); - public boolean a(EntityHuman entityhuman, EnumHand enumhand, @Nullable ItemStack itemstack) { - if (itemstack != null && itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild && !this.isBaby()) { + if (itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild && !this.isBaby()) { + // CraftBukkit start - Got milk? + org.bukkit.Location loc = this.getBukkitEntity().getLocation(); + org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), null, itemstack, Items.MILK_BUCKET); @@ -24,12 +24,12 @@ + } + + ItemStack result = CraftItemStack.asNMSCopy(event.getItemStack()); - entityhuman.a(SoundEffects.ap, 1.0F, 1.0F); -- if (--itemstack.count == 0) { + entityhuman.a(SoundEffects.ar, 1.0F, 1.0F); + itemstack.subtract(1); + if (itemstack.isEmpty()) { - entityhuman.a(enumhand, new ItemStack(Items.MILK_BUCKET)); - } else if (!entityhuman.inventory.pickup(new ItemStack(Items.MILK_BUCKET))) { - entityhuman.drop(new ItemStack(Items.MILK_BUCKET), false); -+ if (--itemstack.count <= 0) { + entityhuman.a(enumhand, result); + } else if (!entityhuman.inventory.pickup(result)) { + entityhuman.drop(result, false); |