--- a/net/minecraft/world/entity/animal/goat/Goat.java
+++ b/net/minecraft/world/entity/animal/goat/Goat.java
@@ -54,6 +54,12 @@
 import net.minecraft.world.level.pathfinder.PathType;
 import net.minecraft.world.phys.Vec3D;
 
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.event.player.PlayerBucketFillEvent;
+// CraftBukkit end
+
 public class Goat extends EntityAnimal {
 
     public static final EntitySize LONG_JUMPING_DIMENSIONS = EntitySize.scalable(0.9F, 1.3F).scale(0.7F);
@@ -181,7 +187,7 @@
 
     @Override
     public BehaviorController<Goat> getBrain() {
-        return super.getBrain();
+        return (BehaviorController<Goat>) super.getBrain(); // CraftBukkit - decompile error
     }
 
     @Override
@@ -219,8 +225,15 @@
         ItemStack itemstack = entityhuman.getItemInHand(enumhand);
 
         if (itemstack.is(Items.BUCKET) && !this.isBaby()) {
+            // CraftBukkit start - Got milk?
+            PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) entityhuman.level(), entityhuman, this.blockPosition(), this.blockPosition(), null, itemstack, Items.MILK_BUCKET, enumhand);
+
+            if (event.isCancelled()) {
+                return EnumInteractionResult.PASS;
+            }
+            // CraftBukkit end
             entityhuman.playSound(this.getMilkingSound(), 1.0F, 1.0F);
-            ItemStack itemstack1 = ItemLiquidUtil.createFilledResult(itemstack, entityhuman, Items.MILK_BUCKET.getDefaultInstance());
+            ItemStack itemstack1 = ItemLiquidUtil.createFilledResult(itemstack, entityhuman, CraftItemStack.asNMSCopy(event.getItemStack())); // CraftBukkit
 
             entityhuman.setItemInHand(enumhand, itemstack1);
             return EnumInteractionResult.sidedSuccess(this.level().isClientSide);
