mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-17 16:15:24 +01:00
32 lines
1.4 KiB
Diff
32 lines
1.4 KiB
Diff
--- a/net/minecraft/server/EntityCow.java
|
|
+++ b/net/minecraft/server/EntityCow.java
|
|
@@ -1,5 +1,10 @@
|
|
package net.minecraft.server;
|
|
|
|
+// CraftBukkit start
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
|
+// CraftBukkit end
|
|
+
|
|
public class EntityCow extends EntityAnimal {
|
|
|
|
public EntityCow(EntityTypes<? extends EntityCow> entitytypes, World world) {
|
|
@@ -52,8 +57,16 @@
|
|
ItemStack itemstack = entityhuman.b(enumhand);
|
|
|
|
if (itemstack.getItem() == Items.BUCKET && !this.isBaby()) {
|
|
+ // CraftBukkit start - Got milk?
|
|
+ org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) entityhuman.world, entityhuman, this.getChunkCoordinates(), this.getChunkCoordinates(), null, itemstack, Items.MILK_BUCKET);
|
|
+
|
|
+ if (event.isCancelled()) {
|
|
+ return EnumInteractionResult.PASS;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
+
|
|
entityhuman.playSound(SoundEffects.ENTITY_COW_MILK, 1.0F, 1.0F);
|
|
- ItemStack itemstack1 = ItemLiquidUtil.a(itemstack, entityhuman, Items.MILK_BUCKET.r());
|
|
+ ItemStack itemstack1 = ItemLiquidUtil.a(itemstack, entityhuman, CraftItemStack.asNMSCopy(event.getItemStack())); // CraftBukkit
|
|
|
|
entityhuman.a(enumhand, itemstack1);
|
|
return EnumInteractionResult.a(this.world.isClientSide);
|