--- a/net/minecraft/world/entity/animal/goat/Goat.java
+++ b/net/minecraft/world/entity/animal/goat/Goat.java
@@ -4,6 +4,7 @@
 import com.mojang.serialization.Dynamic;
 import javax.annotation.Nullable;
 import net.minecraft.core.BlockPos;
+import net.minecraft.core.Holder;
 import net.minecraft.core.HolderSet;
 import net.minecraft.core.Registry;
 import net.minecraft.nbt.CompoundTag;
@@ -25,6 +26,7 @@
 import net.minecraft.world.InteractionResult;
 import net.minecraft.world.damagesource.DamageSource;
 import net.minecraft.world.entity.AgeableMob;
+import net.minecraft.world.entity.Entity;
 import net.minecraft.world.entity.EntityDimensions;
 import net.minecraft.world.entity.EntityType;
 import net.minecraft.world.entity.Mob;
@@ -51,16 +53,21 @@
 import net.minecraft.world.level.block.state.BlockState;
 import net.minecraft.world.level.pathfinder.BlockPathTypes;
 import net.minecraft.world.phys.Vec3;
+// CraftBukkit start
+import org.bukkit.craftbukkit.v1_19_R1.event.CraftEventFactory;
+import org.bukkit.craftbukkit.v1_19_R1.inventory.CraftItemStack;
+// CraftBukkit end
 
 public class Goat extends Animal {
+
     public static final EntityDimensions LONG_JUMPING_DIMENSIONS = EntityDimensions.scalable(0.9F, 1.3F).scale(0.7F);
     private static final int ADULT_ATTACK_DAMAGE = 2;
     private static final int BABY_ATTACK_DAMAGE = 1;
     protected static final ImmutableList<SensorType<? extends Sensor<? super Goat>>> SENSOR_TYPES = ImmutableList.of(SensorType.NEAREST_LIVING_ENTITIES, SensorType.NEAREST_PLAYERS, SensorType.NEAREST_ITEMS, SensorType.NEAREST_ADULT, SensorType.HURT_BY, SensorType.GOAT_TEMPTATIONS);
-    protected static final ImmutableList<MemoryModuleType<?>> MEMORY_TYPES = ImmutableList.of(MemoryModuleType.LOOK_TARGET, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.WALK_TARGET, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.PATH, MemoryModuleType.ATE_RECENTLY, MemoryModuleType.BREED_TARGET, MemoryModuleType.LONG_JUMP_COOLDOWN_TICKS, MemoryModuleType.LONG_JUMP_MID_JUMP, MemoryModuleType.TEMPTING_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ADULT, MemoryModuleType.TEMPTATION_COOLDOWN_TICKS, MemoryModuleType.IS_TEMPTED, MemoryModuleType.RAM_COOLDOWN_TICKS, MemoryModuleType.RAM_TARGET, MemoryModuleType.IS_PANICKING);
+    protected static final ImmutableList<MemoryModuleType<?>> MEMORY_TYPES = ImmutableList.of(MemoryModuleType.LOOK_TARGET, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.WALK_TARGET, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.PATH, MemoryModuleType.ATE_RECENTLY, MemoryModuleType.BREED_TARGET, MemoryModuleType.LONG_JUMP_COOLDOWN_TICKS, MemoryModuleType.LONG_JUMP_MID_JUMP, MemoryModuleType.TEMPTING_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ADULT, MemoryModuleType.TEMPTATION_COOLDOWN_TICKS, new MemoryModuleType[]{MemoryModuleType.IS_TEMPTED, MemoryModuleType.RAM_COOLDOWN_TICKS, MemoryModuleType.RAM_TARGET, MemoryModuleType.IS_PANICKING});
     public static final int GOAT_FALL_DAMAGE_REDUCTION = 10;
     public static final double GOAT_SCREAMING_CHANCE = 0.02D;
-    public static final double UNIHORN_CHANCE = (double)0.1F;
+    public static final double UNIHORN_CHANCE = 0.10000000149011612D;
     private static final EntityDataAccessor<Boolean> DATA_IS_SCREAMING_GOAT = SynchedEntityData.defineId(Goat.class, EntityDataSerializers.BOOLEAN);
     public static final EntityDataAccessor<Boolean> DATA_HAS_LEFT_HORN = SynchedEntityData.defineId(Goat.class, EntityDataSerializers.BOOLEAN);
     public static final EntityDataAccessor<Boolean> DATA_HAS_RIGHT_HORN = SynchedEntityData.defineId(Goat.class, EntityDataSerializers.BOOLEAN);
@@ -75,15 +82,16 @@
     }
 
     public ItemStack createHorn() {
-        RandomSource randomSource = RandomSource.create((long)this.getUUID().hashCode());
-        TagKey<Instrument> tagKey = this.isScreamingGoat() ? InstrumentTags.SCREAMING_GOAT_HORNS : InstrumentTags.REGULAR_GOAT_HORNS;
-        HolderSet<Instrument> holderSet = Registry.INSTRUMENT.getOrCreateTag(tagKey);
-        return InstrumentItem.create(Items.GOAT_HORN, holderSet.getRandomElement(randomSource).get());
+        RandomSource randomsource = RandomSource.create((long) this.getUUID().hashCode());
+        TagKey<Instrument> tagkey = this.isScreamingGoat() ? InstrumentTags.SCREAMING_GOAT_HORNS : InstrumentTags.REGULAR_GOAT_HORNS;
+        HolderSet<Instrument> holderset = Registry.INSTRUMENT.getOrCreateTag(tagkey);
+
+        return InstrumentItem.create(Items.GOAT_HORN, (Holder) holderset.getRandomElement(randomsource).get());
     }
 
     @Override
     protected Brain.Provider<Goat> brainProvider() {
-        return Brain.provider(MEMORY_TYPES, SENSOR_TYPES);
+        return Brain.provider(Goat.MEMORY_TYPES, Goat.SENSOR_TYPES);
     }
 
     @Override
@@ -92,7 +100,7 @@
     }
 
     public static AttributeSupplier.Builder createAttributes() {
-        return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 10.0D).add(Attributes.MOVEMENT_SPEED, (double)0.2F).add(Attributes.ATTACK_DAMAGE, 2.0D);
+        return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 10.0D).add(Attributes.MOVEMENT_SPEED, 0.20000000298023224D).add(Attributes.ATTACK_DAMAGE, 2.0D);
     }
 
     @Override
@@ -137,12 +145,14 @@
     }
 
     @Override
-    public Goat getBreedOffspring(ServerLevel serverLevel, AgeableMob ageableMob) {
-        Goat goat = EntityType.GOAT.create(serverLevel);
+    public Goat getBreedOffspring(ServerLevel world, AgeableMob entity) {
+        Goat goat = (Goat) EntityType.GOAT.create(world);
+
         if (goat != null) {
-            GoatAi.initMemories(goat, serverLevel.getRandom());
-            boolean bl = ageableMob instanceof Goat && ((Goat)ageableMob).isScreamingGoat();
-            goat.setScreamingGoat(bl || serverLevel.getRandom().nextDouble() < 0.02D);
+            GoatAi.initMemories(goat, world.getRandom());
+            boolean flag = entity instanceof Goat && ((Goat) entity).isScreamingGoat();
+
+            goat.setScreamingGoat(flag || world.getRandom().nextDouble() < 0.02D);
         }
 
         return goat;
@@ -150,13 +160,13 @@
 
     @Override
     public Brain<Goat> getBrain() {
-        return super.getBrain();
+        return (Brain<Goat>) super.getBrain(); // CraftBukkit - decompile error
     }
 
     @Override
     protected void customServerAiStep() {
         this.level.getProfiler().push("goatBrain");
-        this.getBrain().tick((ServerLevel)this.level, this);
+        this.getBrain().tick((ServerLevel) this.level, this);
         this.level.getProfiler().pop();
         this.level.getProfiler().push("goatActivityUpdate");
         GoatAi.updateActivity(this);
@@ -172,9 +182,10 @@
     @Override
     public void setYHeadRot(float headYaw) {
         int i = this.getMaxHeadYRot();
-        float f = Mth.degreesDifference(this.yBodyRot, headYaw);
-        float g = Mth.clamp(f, (float)(-i), (float)i);
-        super.setYHeadRot(this.yBodyRot + g);
+        float f1 = Mth.degreesDifference(this.yBodyRot, headYaw);
+        float f2 = Mth.clamp(f1, (float) (-i), (float) i);
+
+        super.setYHeadRot(this.yBodyRot + f2);
     }
 
     @Override
@@ -184,31 +195,43 @@
 
     @Override
     public InteractionResult mobInteract(Player player, InteractionHand hand) {
-        ItemStack itemStack = player.getItemInHand(hand);
-        if (itemStack.is(Items.BUCKET) && !this.isBaby()) {
+        ItemStack itemstack = player.getItemInHand(hand);
+
+        if (itemstack.is(Items.BUCKET) && !this.isBaby()) {
+            // CraftBukkit start - Got milk?
+            org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((ServerLevel) player.level, player, this.blockPosition(), this.blockPosition(), null, itemstack, Items.MILK_BUCKET, hand); // Paper - add enumHand
+
+            if (event.isCancelled()) {
+                return InteractionResult.PASS;
+            }
+            // CraftBukkit end
             player.playSound(this.getMilkingSound(), 1.0F, 1.0F);
-            ItemStack itemStack2 = ItemUtils.createFilledResult(itemStack, player, Items.MILK_BUCKET.getDefaultInstance());
-            player.setItemInHand(hand, itemStack2);
+            ItemStack itemstack1 = ItemUtils.createFilledResult(itemstack, player, CraftItemStack.asNMSCopy(event.getItemStack())); // CraftBukkit
+
+            player.setItemInHand(hand, itemstack1);
             return InteractionResult.sidedSuccess(this.level.isClientSide);
         } else {
-            InteractionResult interactionResult = super.mobInteract(player, hand);
-            if (interactionResult.consumesAction() && this.isFood(itemStack)) {
-                this.level.playSound((Player)null, this, this.getEatingSound(itemStack), SoundSource.NEUTRAL, 1.0F, Mth.randomBetween(this.level.random, 0.8F, 1.2F));
+            InteractionResult enuminteractionresult = super.mobInteract(player, hand);
+
+            if (enuminteractionresult.consumesAction() && this.isFood(itemstack)) {
+                this.level.playSound((Player) null, (Entity) this, this.getEatingSound(itemstack), SoundSource.NEUTRAL, 1.0F, Mth.randomBetween(this.level.random, 0.8F, 1.2F));
             }
 
-            return interactionResult;
+            return enuminteractionresult;
         }
     }
 
     @Override
     public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, @Nullable SpawnGroupData entityData, @Nullable CompoundTag entityNbt) {
-        RandomSource randomSource = world.getRandom();
-        GoatAi.initMemories(this, randomSource);
-        this.setScreamingGoat(randomSource.nextDouble() < 0.02D);
+        RandomSource randomsource = world.getRandom();
+
+        GoatAi.initMemories(this, randomsource);
+        this.setScreamingGoat(randomsource.nextDouble() < 0.02D);
         this.ageBoundaryReached();
-        if (!this.isBaby() && (double)randomSource.nextFloat() < (double)0.1F) {
-            EntityDataAccessor<Boolean> entityDataAccessor = randomSource.nextBoolean() ? DATA_HAS_LEFT_HORN : DATA_HAS_RIGHT_HORN;
-            this.entityData.set(entityDataAccessor, false);
+        if (!this.isBaby() && (double) randomsource.nextFloat() < 0.10000000149011612D) {
+            EntityDataAccessor<Boolean> datawatcherobject = randomsource.nextBoolean() ? Goat.DATA_HAS_LEFT_HORN : Goat.DATA_HAS_RIGHT_HORN;
+
+            this.entityData.set(datawatcherobject, false);
         }
 
         return super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityNbt);
@@ -222,7 +245,7 @@
 
     @Override
     public EntityDimensions getDimensions(Pose pose) {
-        return pose == Pose.LONG_JUMPING ? LONG_JUMPING_DIMENSIONS.scale(this.getScale()) : super.getDimensions(pose);
+        return pose == Pose.LONG_JUMPING ? Goat.LONG_JUMPING_DIMENSIONS.scale(this.getScale()) : super.getDimensions(pose);
     }
 
     @Override
@@ -237,8 +260,8 @@
     public void readAdditionalSaveData(CompoundTag nbt) {
         super.readAdditionalSaveData(nbt);
         this.setScreamingGoat(nbt.getBoolean("IsScreamingGoat"));
-        this.entityData.set(DATA_HAS_LEFT_HORN, nbt.getBoolean("HasLeftHorn"));
-        this.entityData.set(DATA_HAS_RIGHT_HORN, nbt.getBoolean("HasRightHorn"));
+        this.entityData.set(Goat.DATA_HAS_LEFT_HORN, nbt.getBoolean("HasLeftHorn"));
+        this.entityData.set(Goat.DATA_HAS_RIGHT_HORN, nbt.getBoolean("HasRightHorn"));
     }
 
     @Override
@@ -261,76 +284,89 @@
             this.lowerHeadTick -= 2;
         }
 
-        this.lowerHeadTick = Mth.clamp(this.lowerHeadTick, 0, 20);
+        this.lowerHeadTick = Mth.clamp(this.lowerHeadTick, (int) 0, (int) 20);
         super.aiStep();
     }
 
     @Override
     protected void defineSynchedData() {
         super.defineSynchedData();
-        this.entityData.define(DATA_IS_SCREAMING_GOAT, false);
-        this.entityData.define(DATA_HAS_LEFT_HORN, true);
-        this.entityData.define(DATA_HAS_RIGHT_HORN, true);
+        this.entityData.define(Goat.DATA_IS_SCREAMING_GOAT, false);
+        this.entityData.define(Goat.DATA_HAS_LEFT_HORN, true);
+        this.entityData.define(Goat.DATA_HAS_RIGHT_HORN, true);
     }
 
     public boolean hasLeftHorn() {
-        return this.entityData.get(DATA_HAS_LEFT_HORN);
+        return (Boolean) this.entityData.get(Goat.DATA_HAS_LEFT_HORN);
     }
 
     public boolean hasRightHorn() {
-        return this.entityData.get(DATA_HAS_RIGHT_HORN);
+        return (Boolean) this.entityData.get(Goat.DATA_HAS_RIGHT_HORN);
     }
 
     public boolean dropHorn() {
-        boolean bl = this.hasLeftHorn();
-        boolean bl2 = this.hasRightHorn();
-        if (!bl && !bl2) {
+        boolean flag = this.hasLeftHorn();
+        boolean flag1 = this.hasRightHorn();
+
+        if (!flag && !flag1) {
             return false;
         } else {
-            EntityDataAccessor<Boolean> entityDataAccessor;
-            if (!bl) {
-                entityDataAccessor = DATA_HAS_RIGHT_HORN;
-            } else if (!bl2) {
-                entityDataAccessor = DATA_HAS_LEFT_HORN;
+            EntityDataAccessor datawatcherobject;
+
+            if (!flag) {
+                datawatcherobject = Goat.DATA_HAS_RIGHT_HORN;
+            } else if (!flag1) {
+                datawatcherobject = Goat.DATA_HAS_LEFT_HORN;
             } else {
-                entityDataAccessor = this.random.nextBoolean() ? DATA_HAS_LEFT_HORN : DATA_HAS_RIGHT_HORN;
+                datawatcherobject = this.random.nextBoolean() ? Goat.DATA_HAS_LEFT_HORN : Goat.DATA_HAS_RIGHT_HORN;
             }
 
-            this.entityData.set(entityDataAccessor, false);
-            Vec3 vec3 = this.position();
-            ItemStack itemStack = this.createHorn();
-            double d = (double)Mth.randomBetween(this.random, -0.2F, 0.2F);
-            double e = (double)Mth.randomBetween(this.random, 0.3F, 0.7F);
-            double f = (double)Mth.randomBetween(this.random, -0.2F, 0.2F);
-            ItemEntity itemEntity = new ItemEntity(this.level, vec3.x(), vec3.y(), vec3.z(), itemStack, d, e, f);
-            this.level.addFreshEntity(itemEntity);
-            return true;
+            this.entityData.set(datawatcherobject, false);
+            Vec3 vec3d = this.position();
+            ItemStack itemstack = this.createHorn();
+            double d0 = (double) Mth.randomBetween(this.random, -0.2F, 0.2F);
+            double d1 = (double) Mth.randomBetween(this.random, 0.3F, 0.7F);
+            double d2 = (double) Mth.randomBetween(this.random, -0.2F, 0.2F);
+            ItemEntity entityitem = new ItemEntity(this.level, vec3d.x(), vec3d.y(), vec3d.z(), itemstack, d0, d1, d2);
+
+            return this.spawnAtLocation(entityitem) != null; // Paper - call EntityDropItemEvent by calling spawnAtLocation.
         }
     }
 
     public void addHorns() {
-        this.entityData.set(DATA_HAS_LEFT_HORN, true);
-        this.entityData.set(DATA_HAS_RIGHT_HORN, true);
+        this.entityData.set(Goat.DATA_HAS_LEFT_HORN, true);
+        this.entityData.set(Goat.DATA_HAS_RIGHT_HORN, true);
     }
 
     public void removeHorns() {
-        this.entityData.set(DATA_HAS_LEFT_HORN, false);
-        this.entityData.set(DATA_HAS_RIGHT_HORN, false);
+        this.entityData.set(Goat.DATA_HAS_LEFT_HORN, false);
+        this.entityData.set(Goat.DATA_HAS_RIGHT_HORN, false);
     }
 
     public boolean isScreamingGoat() {
-        return this.entityData.get(DATA_IS_SCREAMING_GOAT);
+        return (Boolean) this.entityData.get(Goat.DATA_IS_SCREAMING_GOAT);
     }
 
     public void setScreamingGoat(boolean screaming) {
-        this.entityData.set(DATA_IS_SCREAMING_GOAT, screaming);
+        this.entityData.set(Goat.DATA_IS_SCREAMING_GOAT, screaming);
     }
 
     public float getRammingXHeadRot() {
-        return (float)this.lowerHeadTick / 20.0F * 30.0F * ((float)Math.PI / 180F);
+        return (float) this.lowerHeadTick / 20.0F * 30.0F * 0.017453292F;
     }
 
     public static boolean checkGoatSpawnRules(EntityType<? extends Animal> entityType, LevelAccessor world, MobSpawnType spawnReason, BlockPos pos, RandomSource random) {
         return world.getBlockState(pos.below()).is(BlockTags.GOATS_SPAWNABLE_ON) && isBrightEnoughToSpawn(world, pos);
     }
+
+    // Paper start - Goat ram API
+    public void ram(net.minecraft.world.entity.LivingEntity entity) {
+        Brain<Goat> brain = this.getBrain();
+        brain.setMemory(MemoryModuleType.RAM_TARGET, entity.position());
+        brain.eraseMemory(MemoryModuleType.RAM_COOLDOWN_TICKS);
+        brain.eraseMemory(MemoryModuleType.BREED_TARGET);
+        brain.eraseMemory(MemoryModuleType.TEMPTING_PLAYER);
+        brain.setActiveActivityIfPossible(net.minecraft.world.entity.schedule.Activity.RAM);
+    }
+    // Paper end
 }
