--- a/net/minecraft/world/entity/animal/Panda.java
+++ b/net/minecraft/world/entity/animal/Panda.java
@@ -1,7 +1,9 @@
 package net.minecraft.world.entity.animal;
 
 import java.util.EnumSet;
+import java.util.Iterator;
 import java.util.List;
+import java.util.Objects;
 import java.util.function.IntFunction;
 import java.util.function.Predicate;
 import javax.annotation.Nullable;
@@ -70,19 +72,22 @@
 import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets;
 import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
 import net.minecraft.world.phys.Vec3;
+// CraftBukkit start;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.event.entity.EntityRemoveEvent;
+import org.bukkit.event.entity.EntityTargetEvent;
+// CraftBukkit end
 
 public class Panda extends Animal {
+
     private static final EntityDataAccessor<Integer> UNHAPPY_COUNTER = SynchedEntityData.defineId(Panda.class, EntityDataSerializers.INT);
     private static final EntityDataAccessor<Integer> SNEEZE_COUNTER = SynchedEntityData.defineId(Panda.class, EntityDataSerializers.INT);
     private static final EntityDataAccessor<Integer> EAT_COUNTER = SynchedEntityData.defineId(Panda.class, EntityDataSerializers.INT);
     private static final EntityDataAccessor<Byte> MAIN_GENE_ID = SynchedEntityData.defineId(Panda.class, EntityDataSerializers.BYTE);
     private static final EntityDataAccessor<Byte> HIDDEN_GENE_ID = SynchedEntityData.defineId(Panda.class, EntityDataSerializers.BYTE);
     private static final EntityDataAccessor<Byte> DATA_ID_FLAGS = SynchedEntityData.defineId(Panda.class, EntityDataSerializers.BYTE);
-    static final TargetingConditions BREED_TARGETING = TargetingConditions.forNonCombat().range(8.0);
-    private static final EntityDimensions BABY_DIMENSIONS = EntityType.PANDA
-        .getDimensions()
-        .scale(0.5F)
-        .withAttachments(EntityAttachments.builder().attach(EntityAttachment.PASSENGER, 0.0F, 0.40625F, 0.0F));
+    static final TargetingConditions BREED_TARGETING = TargetingConditions.forNonCombat().range(8.0D);
+    private static final EntityDimensions BABY_DIMENSIONS = EntityType.PANDA.getDimensions().scale(0.5F).withAttachments(EntityAttachments.builder().attach(EntityAttachment.PASSENGER, 0.0F, 0.40625F, 0.0F));
     private static final int FLAG_SNEEZE = 2;
     private static final int FLAG_ROLL = 4;
     private static final int FLAG_SIT = 8;
@@ -101,9 +106,10 @@
     private float rollAmount;
     private float rollAmountO;
     Panda.PandaLookAtPlayerGoal lookAtPlayerGoal;
-    static final Predicate<ItemEntity> PANDA_ITEMS = item -> {
-        ItemStack itemStack = item.getItem();
-        return (itemStack.is(Blocks.BAMBOO.asItem()) || itemStack.is(Blocks.CAKE.asItem())) && item.isAlive() && !item.hasPickUpDelay();
+    static final Predicate<ItemEntity> PANDA_ITEMS = (entityitem) -> {
+        ItemStack itemstack = entityitem.getItem();
+
+        return (itemstack.is(Blocks.BAMBOO.asItem()) || itemstack.is(Blocks.CAKE.asItem())) && entityitem.isAlive() && !entityitem.hasPickUpDelay();
     };
 
     public Panda(EntityType<? extends Panda> type, Level world) {
@@ -112,20 +118,22 @@
         if (!this.isBaby()) {
             this.setCanPickUpLoot(true);
         }
+
     }
 
     @Override
     public boolean canTakeItem(ItemStack stack) {
-        EquipmentSlot equipmentSlot = this.getEquipmentSlotForItem(stack);
-        return this.getItemBySlot(equipmentSlot).isEmpty() && equipmentSlot == EquipmentSlot.MAINHAND && super.canTakeItem(stack);
+        EquipmentSlot enumitemslot = this.getEquipmentSlotForItem(stack);
+
+        return !this.getItemBySlot(enumitemslot).isEmpty() ? false : enumitemslot == EquipmentSlot.MAINHAND && super.canTakeItem(stack);
     }
 
     public int getUnhappyCounter() {
-        return this.entityData.get(UNHAPPY_COUNTER);
+        return (Integer) this.entityData.get(Panda.UNHAPPY_COUNTER);
     }
 
     public void setUnhappyCounter(int askForBambooTicks) {
-        this.entityData.set(UNHAPPY_COUNTER, askForBambooTicks);
+        this.entityData.set(Panda.UNHAPPY_COUNTER, askForBambooTicks);
     }
 
     public boolean isSneezing() {
@@ -137,6 +145,7 @@
     }
 
     public void sit(boolean sitting) {
+        if (!new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), sitting).callEvent()) return; // Paper - Add EntityToggleSitEvent
         this.setFlag(8, sitting);
     }
 
@@ -149,19 +158,19 @@
     }
 
     public boolean isEating() {
-        return this.entityData.get(EAT_COUNTER) > 0;
+        return (Integer) this.entityData.get(Panda.EAT_COUNTER) > 0;
     }
 
     public void eat(boolean eating) {
-        this.entityData.set(EAT_COUNTER, eating ? 1 : 0);
+        this.entityData.set(Panda.EAT_COUNTER, eating ? 1 : 0);
     }
 
     public int getEatCounter() {
-        return this.entityData.get(EAT_COUNTER);
+        return (Integer) this.entityData.get(Panda.EAT_COUNTER);
     }
 
     public void setEatCounter(int eatingTicks) {
-        this.entityData.set(EAT_COUNTER, eatingTicks);
+        this.entityData.set(Panda.EAT_COUNTER, eatingTicks);
     }
 
     public void sneeze(boolean sneezing) {
@@ -169,18 +178,19 @@
         if (!sneezing) {
             this.setSneezeCounter(0);
         }
+
     }
 
     public int getSneezeCounter() {
-        return this.entityData.get(SNEEZE_COUNTER);
+        return (Integer) this.entityData.get(Panda.SNEEZE_COUNTER);
     }
 
     public void setSneezeCounter(int sneezeProgress) {
-        this.entityData.set(SNEEZE_COUNTER, sneezeProgress);
+        this.entityData.set(Panda.SNEEZE_COUNTER, sneezeProgress);
     }
 
     public Panda.Gene getMainGene() {
-        return Panda.Gene.byId(this.entityData.get(MAIN_GENE_ID));
+        return Panda.Gene.byId((Byte) this.entityData.get(Panda.MAIN_GENE_ID));
     }
 
     public void setMainGene(Panda.Gene gene) {
@@ -188,11 +198,11 @@
             gene = Panda.Gene.getRandom(this.random);
         }
 
-        this.entityData.set(MAIN_GENE_ID, (byte)gene.getId());
+        this.entityData.set(Panda.MAIN_GENE_ID, (byte) gene.getId());
     }
 
     public Panda.Gene getHiddenGene() {
-        return Panda.Gene.byId(this.entityData.get(HIDDEN_GENE_ID));
+        return Panda.Gene.byId((Byte) this.entityData.get(Panda.HIDDEN_GENE_ID));
     }
 
     public void setHiddenGene(Panda.Gene gene) {
@@ -200,7 +210,7 @@
             gene = Panda.Gene.getRandom(this.random);
         }
 
-        this.entityData.set(HIDDEN_GENE_ID, (byte)gene.getId());
+        this.entityData.set(Panda.HIDDEN_GENE_ID, (byte) gene.getId());
     }
 
     public boolean isRolling() {
@@ -214,25 +224,27 @@
     @Override
     protected void defineSynchedData(SynchedEntityData.Builder builder) {
         super.defineSynchedData(builder);
-        builder.define(UNHAPPY_COUNTER, 0);
-        builder.define(SNEEZE_COUNTER, 0);
-        builder.define(MAIN_GENE_ID, (byte)0);
-        builder.define(HIDDEN_GENE_ID, (byte)0);
-        builder.define(DATA_ID_FLAGS, (byte)0);
-        builder.define(EAT_COUNTER, 0);
+        builder.define(Panda.UNHAPPY_COUNTER, 0);
+        builder.define(Panda.SNEEZE_COUNTER, 0);
+        builder.define(Panda.MAIN_GENE_ID, (byte) 0);
+        builder.define(Panda.HIDDEN_GENE_ID, (byte) 0);
+        builder.define(Panda.DATA_ID_FLAGS, (byte) 0);
+        builder.define(Panda.EAT_COUNTER, 0);
     }
 
     private boolean getFlag(int bitmask) {
-        return (this.entityData.get(DATA_ID_FLAGS) & bitmask) != 0;
+        return ((Byte) this.entityData.get(Panda.DATA_ID_FLAGS) & bitmask) != 0;
     }
 
     private void setFlag(int mask, boolean value) {
-        byte b = this.entityData.get(DATA_ID_FLAGS);
+        byte b0 = (Byte) this.entityData.get(Panda.DATA_ID_FLAGS);
+
         if (value) {
-            this.entityData.set(DATA_ID_FLAGS, (byte)(b | mask));
+            this.entityData.set(Panda.DATA_ID_FLAGS, (byte) (b0 | mask));
         } else {
-            this.entityData.set(DATA_ID_FLAGS, (byte)(b & ~mask));
+            this.entityData.set(Panda.DATA_ID_FLAGS, (byte) (b0 & ~mask));
         }
+
     }
 
     @Override
@@ -252,27 +264,32 @@
     @Nullable
     @Override
     public AgeableMob getBreedOffspring(ServerLevel world, AgeableMob entity) {
-        Panda panda = EntityType.PANDA.create(world);
-        if (panda != null) {
-            if (entity instanceof Panda panda2) {
-                panda.setGeneFromParents(this, panda2);
+        Panda entitypanda = (Panda) EntityType.PANDA.create(world);
+
+        if (entitypanda != null) {
+            if (entity instanceof Panda) {
+                Panda entitypanda1 = (Panda) entity;
+
+                entitypanda.setGeneFromParents(this, entitypanda1);
             }
 
-            panda.setAttributes();
+            entitypanda.setAttributes();
         }
 
-        return panda;
+        return entitypanda;
     }
 
     @Override
     protected void registerGoals() {
         this.goalSelector.addGoal(0, new FloatGoal(this));
-        this.goalSelector.addGoal(2, new Panda.PandaPanicGoal(this, 2.0));
-        this.goalSelector.addGoal(2, new Panda.PandaBreedGoal(this, 1.0));
-        this.goalSelector.addGoal(3, new Panda.PandaAttackGoal(this, 1.2F, true));
-        this.goalSelector.addGoal(4, new TemptGoal(this, 1.0, stack -> stack.is(ItemTags.PANDA_FOOD), false));
-        this.goalSelector.addGoal(6, new Panda.PandaAvoidGoal<>(this, Player.class, 8.0F, 2.0, 2.0));
-        this.goalSelector.addGoal(6, new Panda.PandaAvoidGoal<>(this, Monster.class, 4.0F, 2.0, 2.0));
+        this.goalSelector.addGoal(2, new Panda.PandaPanicGoal(this, 2.0D));
+        this.goalSelector.addGoal(2, new Panda.PandaBreedGoal(this, 1.0D));
+        this.goalSelector.addGoal(3, new Panda.PandaAttackGoal(this, 1.2000000476837158D, true));
+        this.goalSelector.addGoal(4, new TemptGoal(this, 1.0D, (itemstack) -> {
+            return itemstack.is(ItemTags.PANDA_FOOD);
+        }, false));
+        this.goalSelector.addGoal(6, new Panda.PandaAvoidGoal<>(this, Player.class, 8.0F, 2.0D, 2.0D));
+        this.goalSelector.addGoal(6, new Panda.PandaAvoidGoal<>(this, Monster.class, 4.0F, 2.0D, 2.0D));
         this.goalSelector.addGoal(7, new Panda.PandaSitGoal());
         this.goalSelector.addGoal(8, new Panda.PandaLieOnBackGoal(this));
         this.goalSelector.addGoal(8, new Panda.PandaSneezeGoal(this));
@@ -280,13 +297,13 @@
         this.goalSelector.addGoal(9, this.lookAtPlayerGoal);
         this.goalSelector.addGoal(10, new RandomLookAroundGoal(this));
         this.goalSelector.addGoal(12, new Panda.PandaRollGoal(this));
-        this.goalSelector.addGoal(13, new FollowParentGoal(this, 1.25));
-        this.goalSelector.addGoal(14, new WaterAvoidingRandomStrollGoal(this, 1.0));
-        this.targetSelector.addGoal(1, new Panda.PandaHurtByTargetGoal(this).setAlertOthers(new Class[0]));
+        this.goalSelector.addGoal(13, new FollowParentGoal(this, 1.25D));
+        this.goalSelector.addGoal(14, new WaterAvoidingRandomStrollGoal(this, 1.0D));
+        this.targetSelector.addGoal(1, (new Panda.PandaHurtByTargetGoal(this, new Class[0])).setAlertOthers(new Class[0]));
     }
 
     public static AttributeSupplier.Builder createAttributes() {
-        return Mob.createMobAttributes().add(Attributes.MOVEMENT_SPEED, 0.15F).add(Attributes.ATTACK_DAMAGE, 6.0);
+        return Mob.createMobAttributes().add(Attributes.MOVEMENT_SPEED, 0.15000000596046448D).add(Attributes.ATTACK_DAMAGE, 6.0D);
     }
 
     public Panda.Gene getVariant() {
@@ -349,15 +366,16 @@
             }
         }
 
-        LivingEntity livingEntity = this.getTarget();
-        if (livingEntity == null) {
+        LivingEntity entityliving = this.getTarget();
+
+        if (entityliving == null) {
             this.gotBamboo = false;
             this.didBite = false;
         }
 
         if (this.getUnhappyCounter() > 0) {
-            if (livingEntity != null) {
-                this.lookAt(livingEntity, 90.0F, 90.0F);
+            if (entityliving != null) {
+                this.lookAt(entityliving, 90.0F, 90.0F);
             }
 
             if (this.getUnhappyCounter() == 29 || this.getUnhappyCounter() == 14) {
@@ -422,34 +440,27 @@
 
             this.setEatCounter(this.getEatCounter() + 1);
         }
+
     }
 
     private void addEatingParticles() {
         if (this.getEatCounter() % 5 == 0) {
-            this.playSound(
-                SoundEvents.PANDA_EAT, 0.5F + 0.5F * (float)this.random.nextInt(2), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F
-            );
+            this.playSound(SoundEvents.PANDA_EAT, 0.5F + 0.5F * (float) this.random.nextInt(2), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
 
-            for (int i = 0; i < 6; i++) {
-                Vec3 vec3 = new Vec3(((double)this.random.nextFloat() - 0.5) * 0.1, Math.random() * 0.1 + 0.1, ((double)this.random.nextFloat() - 0.5) * 0.1);
-                vec3 = vec3.xRot(-this.getXRot() * (float) (Math.PI / 180.0));
-                vec3 = vec3.yRot(-this.getYRot() * (float) (Math.PI / 180.0));
-                double d = (double)(-this.random.nextFloat()) * 0.6 - 0.3;
-                Vec3 vec32 = new Vec3(((double)this.random.nextFloat() - 0.5) * 0.8, d, 1.0 + ((double)this.random.nextFloat() - 0.5) * 0.4);
-                vec32 = vec32.yRot(-this.yBodyRot * (float) (Math.PI / 180.0));
-                vec32 = vec32.add(this.getX(), this.getEyeY() + 1.0, this.getZ());
-                this.level()
-                    .addParticle(
-                        new ItemParticleOption(ParticleTypes.ITEM, this.getItemBySlot(EquipmentSlot.MAINHAND)),
-                        vec32.x,
-                        vec32.y,
-                        vec32.z,
-                        vec3.x,
-                        vec3.y + 0.05,
-                        vec3.z
-                    );
+            for (int i = 0; i < 6; ++i) {
+                Vec3 vec3d = new Vec3(((double) this.random.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, ((double) this.random.nextFloat() - 0.5D) * 0.1D);
+
+                vec3d = vec3d.xRot(-this.getXRot() * 0.017453292F);
+                vec3d = vec3d.yRot(-this.getYRot() * 0.017453292F);
+                double d0 = (double) (-this.random.nextFloat()) * 0.6D - 0.3D;
+                Vec3 vec3d1 = new Vec3(((double) this.random.nextFloat() - 0.5D) * 0.8D, d0, 1.0D + ((double) this.random.nextFloat() - 0.5D) * 0.4D);
+
+                vec3d1 = vec3d1.yRot(-this.yBodyRot * 0.017453292F);
+                vec3d1 = vec3d1.add(this.getX(), this.getEyeY() + 1.0D, this.getZ());
+                this.level().addParticle(new ItemParticleOption(ParticleTypes.ITEM, this.getItemBySlot(EquipmentSlot.MAINHAND)), vec3d1.x, vec3d1.y, vec3d1.z, vec3d.x, vec3d.y + 0.05D, vec3d.z);
             }
         }
+
     }
 
     private void updateSitAmount() {
@@ -459,6 +470,7 @@
         } else {
             this.sitAmount = Math.max(0.0F, this.sitAmount - 0.19F);
         }
+
     }
 
     private void updateOnBackAnimation() {
@@ -468,6 +480,7 @@
         } else {
             this.onBackAmount = Math.max(0.0F, this.onBackAmount - 0.19F);
         }
+
     }
 
     private void updateRollAmount() {
@@ -477,6 +490,7 @@
         } else {
             this.rollAmount = Math.max(0.0F, this.rollAmount - 0.19F);
         }
+
     }
 
     public float getSitAmount(float tickDelta) {
@@ -492,70 +506,78 @@
     }
 
     private void handleRoll() {
-        this.rollCounter++;
+        ++this.rollCounter;
         if (this.rollCounter > 32) {
             this.roll(false);
         } else {
             if (!this.level().isClientSide) {
-                Vec3 vec3 = this.getDeltaMovement();
+                Vec3 vec3d = this.getDeltaMovement();
+
                 if (this.rollCounter == 1) {
-                    float f = this.getYRot() * (float) (Math.PI / 180.0);
-                    float g = this.isBaby() ? 0.1F : 0.2F;
-                    this.rollDelta = new Vec3(vec3.x + (double)(-Mth.sin(f) * g), 0.0, vec3.z + (double)(Mth.cos(f) * g));
-                    this.setDeltaMovement(this.rollDelta.add(0.0, 0.27, 0.0));
-                } else if ((float)this.rollCounter != 7.0F && (float)this.rollCounter != 15.0F && (float)this.rollCounter != 23.0F) {
-                    this.setDeltaMovement(this.rollDelta.x, vec3.y, this.rollDelta.z);
+                    float f = this.getYRot() * 0.017453292F;
+                    float f1 = this.isBaby() ? 0.1F : 0.2F;
+
+                    this.rollDelta = new Vec3(vec3d.x + (double) (-Mth.sin(f) * f1), 0.0D, vec3d.z + (double) (Mth.cos(f) * f1));
+                    this.setDeltaMovement(this.rollDelta.add(0.0D, 0.27D, 0.0D));
+                } else if ((float) this.rollCounter != 7.0F && (float) this.rollCounter != 15.0F && (float) this.rollCounter != 23.0F) {
+                    this.setDeltaMovement(this.rollDelta.x, vec3d.y, this.rollDelta.z);
                 } else {
-                    this.setDeltaMovement(0.0, this.onGround() ? 0.27 : vec3.y, 0.0);
+                    this.setDeltaMovement(0.0D, this.onGround() ? 0.27D : vec3d.y, 0.0D);
                 }
             }
+
         }
     }
 
     private void afterSneeze() {
-        Vec3 vec3 = this.getDeltaMovement();
-        Level level = this.level();
-        level.addParticle(
-            ParticleTypes.SNEEZE,
-            this.getX() - (double)(this.getBbWidth() + 1.0F) * 0.5 * (double)Mth.sin(this.yBodyRot * (float) (Math.PI / 180.0)),
-            this.getEyeY() - 0.1F,
-            this.getZ() + (double)(this.getBbWidth() + 1.0F) * 0.5 * (double)Mth.cos(this.yBodyRot * (float) (Math.PI / 180.0)),
-            vec3.x,
-            0.0,
-            vec3.z
-        );
+        Vec3 vec3d = this.getDeltaMovement();
+        Level world = this.level();
+
+        world.addParticle(ParticleTypes.SNEEZE, this.getX() - (double) (this.getBbWidth() + 1.0F) * 0.5D * (double) Mth.sin(this.yBodyRot * 0.017453292F), this.getEyeY() - 0.10000000149011612D, this.getZ() + (double) (this.getBbWidth() + 1.0F) * 0.5D * (double) Mth.cos(this.yBodyRot * 0.017453292F), vec3d.x, 0.0D, vec3d.z);
         this.playSound(SoundEvents.PANDA_SNEEZE, 1.0F, 1.0F);
+        List<Panda> list = world.getEntitiesOfClass(Panda.class, this.getBoundingBox().inflate(10.0D));
+        Iterator iterator = list.iterator();
 
-        for (Panda panda : level.getEntitiesOfClass(Panda.class, this.getBoundingBox().inflate(10.0))) {
-            if (!panda.isBaby() && panda.onGround() && !panda.isInWater() && panda.canPerformAction()) {
-                panda.jumpFromGround();
+        while (iterator.hasNext()) {
+            Panda entitypanda = (Panda) iterator.next();
+
+            if (!entitypanda.isBaby() && entitypanda.onGround() && !entitypanda.isInWater() && entitypanda.canPerformAction()) {
+                if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper - Entity Jump API
+                entitypanda.jumpFromGround();
+                } else { this.setJumping(false); } // Paper - Entity Jump API; setJumping(false) stops a potential loop
             }
         }
 
-        if (!level.isClientSide() && level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
-            ServerLevel serverLevel = (ServerLevel)level;
-            LootTable lootTable = serverLevel.getServer().reloadableRegistries().getLootTable(BuiltInLootTables.PANDA_SNEEZE);
-            LootParams lootParams = new LootParams.Builder(serverLevel)
-                .withParameter(LootContextParams.ORIGIN, this.position())
-                .withParameter(LootContextParams.THIS_ENTITY, this)
-                .create(LootContextParamSets.GIFT);
+        if (!world.isClientSide() && world.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
+            ServerLevel worldserver = (ServerLevel) world;
+            LootTable loottable = worldserver.getServer().reloadableRegistries().getLootTable(BuiltInLootTables.PANDA_SNEEZE);
+            LootParams lootparams = (new LootParams.Builder(worldserver)).withParameter(LootContextParams.ORIGIN, this.position()).withParameter(LootContextParams.THIS_ENTITY, this).create(LootContextParamSets.GIFT);
+            List<ItemStack> list1 = loottable.getRandomItems(lootparams);
+            Iterator iterator1 = list1.iterator();
 
-            for (ItemStack itemStack : lootTable.getRandomItems(lootParams)) {
-                this.spawnAtLocation(itemStack);
+            this.forceDrops = true; // Paper - Add missing forceDrop toggles
+            while (iterator1.hasNext()) {
+                ItemStack itemstack = (ItemStack) iterator1.next();
+
+                this.spawnAtLocation(itemstack);
             }
+            this.forceDrops = false; // Paper - Add missing forceDrop toggles
         }
+
     }
 
     @Override
     protected void pickUpItem(ItemEntity item) {
-        if (this.getItemBySlot(EquipmentSlot.MAINHAND).isEmpty() && PANDA_ITEMS.test(item)) {
+        if (!CraftEventFactory.callEntityPickupItemEvent(this, item, 0, !(this.getItemBySlot(EquipmentSlot.MAINHAND).isEmpty() && Panda.PANDA_ITEMS.test(item))).isCancelled()) { // CraftBukkit
             this.onItemPickup(item);
-            ItemStack itemStack = item.getItem();
-            this.setItemSlot(EquipmentSlot.MAINHAND, itemStack);
+            ItemStack itemstack = item.getItem();
+
+            this.setItemSlot(EquipmentSlot.MAINHAND, itemstack);
             this.setGuaranteedDrop(EquipmentSlot.MAINHAND);
-            this.take(item, itemStack.getCount());
-            item.discard();
+            this.take(item, itemstack.getCount());
+            item.discard(EntityRemoveEvent.Cause.PICKUP); // CraftBukkit - add Bukkit remove cause
         }
+
     }
 
     @Override
@@ -570,15 +592,16 @@
     @Nullable
     @Override
     public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, @Nullable SpawnGroupData entityData) {
-        RandomSource randomSource = world.getRandom();
-        this.setMainGene(Panda.Gene.getRandom(randomSource));
-        this.setHiddenGene(Panda.Gene.getRandom(randomSource));
+        RandomSource randomsource = world.getRandom();
+
+        this.setMainGene(Panda.Gene.getRandom(randomsource));
+        this.setHiddenGene(Panda.Gene.getRandom(randomsource));
         this.setAttributes();
         if (entityData == null) {
             entityData = new AgeableMob.AgeableMobGroupData(0.2F);
         }
 
-        return super.finalizeSpawn(world, difficulty, spawnReason, entityData);
+        return super.finalizeSpawn(world, difficulty, spawnReason, (SpawnGroupData) entityData);
     }
 
     public void setGeneFromParents(Panda mother, @Nullable Panda father) {
@@ -605,6 +628,7 @@
         if (this.random.nextInt(32) == 0) {
             this.setHiddenGene(Panda.Gene.getRandom(this.random));
         }
+
     }
 
     private Panda.Gene getOneOfGenesRandomly() {
@@ -613,12 +637,13 @@
 
     public void setAttributes() {
         if (this.isWeak()) {
-            this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(10.0);
+            this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(10.0D);
         }
 
         if (this.isLazy()) {
-            this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(0.07F);
+            this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(0.07000000029802322D);
         }
+
     }
 
     void tryToSit() {
@@ -627,27 +652,30 @@
             this.getNavigation().stop();
             this.sit(true);
         }
+
     }
 
     @Override
     public InteractionResult mobInteract(Player player, InteractionHand hand) {
-        ItemStack itemStack = player.getItemInHand(hand);
+        ItemStack itemstack = player.getItemInHand(hand);
+
         if (this.isScared()) {
             return InteractionResult.PASS;
         } else if (this.isOnBack()) {
             this.setOnBack(false);
             return InteractionResult.sidedSuccess(this.level().isClientSide);
-        } else if (this.isFood(itemStack)) {
+        } else if (this.isFood(itemstack)) {
             if (this.getTarget() != null) {
                 this.gotBamboo = true;
             }
 
             if (this.isBaby()) {
-                this.usePlayerItem(player, hand, itemStack);
-                this.ageUp((int)((float)(-this.getAge() / 20) * 0.1F), true);
+                this.usePlayerItem(player, hand, itemstack);
+                this.ageUp((int) ((float) (-this.getAge() / 20) * 0.1F), true);
             } else if (!this.level().isClientSide && this.getAge() == 0 && this.canFallInLove()) {
-                this.usePlayerItem(player, hand, itemStack);
-                this.setInLove(player);
+                final ItemStack breedCopy = itemstack.copy(); // Paper - Fix EntityBreedEvent copying
+                this.usePlayerItem(player, hand, itemstack);
+                this.setInLove(player, breedCopy); // Paper - Fix EntityBreedEvent copying
             } else {
                 if (this.level().isClientSide || this.isSitting() || this.isInWater()) {
                     return InteractionResult.PASS;
@@ -655,13 +683,16 @@
 
                 this.tryToSit();
                 this.eat(true);
-                ItemStack itemStack2 = this.getItemBySlot(EquipmentSlot.MAINHAND);
-                if (!itemStack2.isEmpty() && !player.hasInfiniteMaterials()) {
-                    this.spawnAtLocation(itemStack2);
+                ItemStack itemstack1 = this.getItemBySlot(EquipmentSlot.MAINHAND);
+
+                if (!itemstack1.isEmpty() && !player.hasInfiniteMaterials()) {
+                    this.forceDrops = true; // Paper - Add missing forceDrop toggles
+                    this.spawnAtLocation(itemstack1);
+                    this.forceDrops = false; // Paper - Add missing forceDrop toggles
                 }
 
-                this.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(itemStack.getItem(), 1));
-                this.usePlayerItem(player, hand, itemStack);
+                this.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(itemstack.getItem(), 1));
+                this.usePlayerItem(player, hand, itemstack);
             }
 
             return InteractionResult.SUCCESS;
@@ -673,11 +704,7 @@
     @Nullable
     @Override
     protected SoundEvent getAmbientSound() {
-        if (this.isAggressive()) {
-            return SoundEvents.PANDA_AGGRESSIVE_AMBIENT;
-        } else {
-            return this.isWorried() ? SoundEvents.PANDA_WORRIED_AMBIENT : SoundEvents.PANDA_AMBIENT;
-        }
+        return this.isAggressive() ? SoundEvents.PANDA_AGGRESSIVE_AMBIENT : (this.isWorried() ? SoundEvents.PANDA_WORRIED_AMBIENT : SoundEvents.PANDA_AMBIENT);
     }
 
     @Override
@@ -712,17 +739,29 @@
 
     @Override
     public EntityDimensions getDefaultDimensions(Pose pose) {
-        return this.isBaby() ? BABY_DIMENSIONS : super.getDefaultDimensions(pose);
+        return this.isBaby() ? Panda.BABY_DIMENSIONS : super.getDefaultDimensions(pose);
+    }
+
+    private static class PandaMoveControl extends MoveControl {
+
+        private final Panda panda;
+
+        public PandaMoveControl(Panda panda) {
+            super(panda);
+            this.panda = panda;
+        }
+
+        @Override
+        public void tick() {
+            if (this.panda.canPerformAction()) {
+                super.tick();
+            }
+        }
     }
 
     public static enum Gene implements StringRepresentable {
-        NORMAL(0, "normal", false),
-        LAZY(1, "lazy", false),
-        WORRIED(2, "worried", false),
-        PLAYFUL(3, "playful", false),
-        BROWN(4, "brown", true),
-        WEAK(5, "weak", true),
-        AGGRESSIVE(6, "aggressive", false);
+
+        NORMAL(0, "normal", false), LAZY(1, "lazy", false), WORRIED(2, "worried", false), PLAYFUL(3, "playful", false), BROWN(4, "brown", true), WEAK(5, "weak", true), AGGRESSIVE(6, "aggressive", false);
 
         public static final StringRepresentable.EnumCodec<Panda.Gene> CODEC = StringRepresentable.fromEnum(Panda.Gene::values);
         private static final IntFunction<Panda.Gene> BY_ID = ByIdMap.continuous(Panda.Gene::getId, values(), ByIdMap.OutOfBoundsStrategy.ZERO);
@@ -731,10 +770,10 @@
         private final String name;
         private final boolean isRecessive;
 
-        private Gene(final int id, final String name, final boolean recessive) {
-            this.id = id;
-            this.name = name;
-            this.isRecessive = recessive;
+        private Gene(final int i, final String s, final boolean flag) {
+            this.id = i;
+            this.name = s;
+            this.isRecessive = flag;
         }
 
         public int getId() {
@@ -751,68 +790,46 @@
         }
 
         static Panda.Gene getVariantFromGenes(Panda.Gene mainGene, Panda.Gene hiddenGene) {
-            if (mainGene.isRecessive()) {
-                return mainGene == hiddenGene ? mainGene : NORMAL;
-            } else {
-                return mainGene;
-            }
+            return mainGene.isRecessive() ? (mainGene == hiddenGene ? mainGene : Panda.Gene.NORMAL) : mainGene;
         }
 
         public static Panda.Gene byId(int id) {
-            return BY_ID.apply(id);
+            return (Panda.Gene) Panda.Gene.BY_ID.apply(id);
         }
 
         public static Panda.Gene byName(String name) {
-            return CODEC.byName(name, NORMAL);
+            return (Panda.Gene) Panda.Gene.CODEC.byName(name, Panda.Gene.NORMAL);
         }
 
         public static Panda.Gene getRandom(RandomSource random) {
             int i = random.nextInt(16);
-            if (i == 0) {
-                return LAZY;
-            } else if (i == 1) {
-                return WORRIED;
-            } else if (i == 2) {
-                return PLAYFUL;
-            } else if (i == 4) {
-                return AGGRESSIVE;
-            } else if (i < 9) {
-                return WEAK;
-            } else {
-                return i < 11 ? BROWN : NORMAL;
-            }
-        }
-    }
-
-    static class PandaAttackGoal extends MeleeAttackGoal {
-        private final Panda panda;
-
-        public PandaAttackGoal(Panda panda, double speed, boolean pauseWhenMobIdle) {
-            super(panda, speed, pauseWhenMobIdle);
-            this.panda = panda;
-        }
 
-        @Override
-        public boolean canUse() {
-            return this.panda.canPerformAction() && super.canUse();
+            return i == 0 ? Panda.Gene.LAZY : (i == 1 ? Panda.Gene.WORRIED : (i == 2 ? Panda.Gene.PLAYFUL : (i == 4 ? Panda.Gene.AGGRESSIVE : (i < 9 ? Panda.Gene.WEAK : (i < 11 ? Panda.Gene.BROWN : Panda.Gene.NORMAL)))));
         }
     }
 
-    static class PandaAvoidGoal<T extends LivingEntity> extends AvoidEntityGoal<T> {
+    private static class PandaPanicGoal extends PanicGoal {
+
         private final Panda panda;
 
-        public PandaAvoidGoal(Panda panda, Class<T> fleeFromType, float distance, double slowSpeed, double fastSpeed) {
-            super(panda, fleeFromType, distance, slowSpeed, fastSpeed, EntitySelector.NO_SPECTATORS::test);
+        public PandaPanicGoal(Panda panda, double speed) {
+            super(panda, speed, DamageTypeTags.PANIC_ENVIRONMENTAL_CAUSES);
             this.panda = panda;
         }
 
         @Override
-        public boolean canUse() {
-            return this.panda.isWorried() && this.panda.canPerformAction() && super.canUse();
+        public boolean canContinueToUse() {
+            if (this.panda.isSitting()) {
+                this.panda.getNavigation().stop();
+                return false;
+            } else {
+                return super.canContinueToUse();
+            }
         }
     }
 
-    static class PandaBreedGoal extends BreedGoal {
+    private static class PandaBreedGoal extends BreedGoal {
+
         private final Panda panda;
         private int unhappyCooldown;
 
@@ -823,34 +840,37 @@
 
         @Override
         public boolean canUse() {
-            if (!super.canUse() || this.panda.getUnhappyCounter() != 0) {
-                return false;
-            } else if (!this.canFindBamboo()) {
-                if (this.unhappyCooldown <= this.panda.tickCount) {
-                    this.panda.setUnhappyCounter(32);
-                    this.unhappyCooldown = this.panda.tickCount + 600;
-                    if (this.panda.isEffectiveAi()) {
-                        Player player = this.level.getNearestPlayer(Panda.BREED_TARGETING, this.panda);
-                        this.panda.lookAtPlayerGoal.setTarget(player);
+            if (super.canUse() && this.panda.getUnhappyCounter() == 0) {
+                if (!this.canFindBamboo()) {
+                    if (this.unhappyCooldown <= this.panda.tickCount) {
+                        this.panda.setUnhappyCounter(32);
+                        this.unhappyCooldown = this.panda.tickCount + 600;
+                        if (this.panda.isEffectiveAi()) {
+                            Player entityhuman = this.level.getNearestPlayer(Panda.BREED_TARGETING, this.panda);
+
+                            this.panda.lookAtPlayerGoal.setTarget(entityhuman);
+                        }
                     }
-                }
 
-                return false;
+                    return false;
+                } else {
+                    return true;
+                }
             } else {
-                return true;
+                return false;
             }
         }
 
         private boolean canFindBamboo() {
-            BlockPos blockPos = this.panda.blockPosition();
-            BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
+            BlockPos blockposition = this.panda.blockPosition();
+            BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
 
-            for (int i = 0; i < 3; i++) {
-                for (int j = 0; j < 8; j++) {
+            for (int i = 0; i < 3; ++i) {
+                for (int j = 0; j < 8; ++j) {
                     for (int k = 0; k <= j; k = k > 0 ? -k : 1 - k) {
                         for (int l = k < j && k > -j ? j : 0; l <= j; l = l > 0 ? -l : 1 - l) {
-                            mutableBlockPos.setWithOffset(blockPos, k, i, l);
-                            if (this.level.getBlockState(mutableBlockPos).is(Blocks.BAMBOO)) {
+                            blockposition_mutableblockposition.setWithOffset(blockposition, k, i, l);
+                            if (this.level.getBlockState(blockposition_mutableblockposition).is(Blocks.BAMBOO)) {
                                 return true;
                             }
                         }
@@ -862,33 +882,104 @@
         }
     }
 
-    static class PandaHurtByTargetGoal extends HurtByTargetGoal {
+    private static class PandaAttackGoal extends MeleeAttackGoal {
+
         private final Panda panda;
 
-        public PandaHurtByTargetGoal(Panda panda, Class<?>... noRevengeTypes) {
-            super(panda, noRevengeTypes);
+        public PandaAttackGoal(Panda panda, double speed, boolean pauseWhenMobIdle) {
+            super(panda, speed, pauseWhenMobIdle);
             this.panda = panda;
         }
 
         @Override
-        public boolean canContinueToUse() {
-            if (!this.panda.gotBamboo && !this.panda.didBite) {
-                return super.canContinueToUse();
+        public boolean canUse() {
+            return this.panda.canPerformAction() && super.canUse();
+        }
+    }
+
+    private static class PandaAvoidGoal<T extends LivingEntity> extends AvoidEntityGoal<T> {
+
+        private final Panda panda;
+
+        public PandaAvoidGoal(Panda panda, Class<T> fleeFromType, float distance, double slowSpeed, double fastSpeed) {
+            // Predicate predicate = IEntitySelector.NO_SPECTATORS;
+
+            // Objects.requireNonNull(predicate);
+            super(panda, fleeFromType, distance, slowSpeed, fastSpeed, EntitySelector.NO_SPECTATORS::test);
+            this.panda = panda;
+        }
+
+        @Override
+        public boolean canUse() {
+            return this.panda.isWorried() && this.panda.canPerformAction() && super.canUse();
+        }
+    }
+
+    private class PandaSitGoal extends Goal {
+
+        private int cooldown;
+
+        public PandaSitGoal() {
+            this.setFlags(EnumSet.of(Goal.Flag.MOVE));
+        }
+
+        @Override
+        public boolean canUse() {
+            if (this.cooldown <= Panda.this.tickCount && !Panda.this.isBaby() && !Panda.this.isInWater() && Panda.this.canPerformAction() && Panda.this.getUnhappyCounter() <= 0) {
+                List<ItemEntity> list = Panda.this.level().getEntitiesOfClass(ItemEntity.class, Panda.this.getBoundingBox().inflate(6.0D, 6.0D, 6.0D), Panda.PANDA_ITEMS);
+
+                return !list.isEmpty() || !Panda.this.getItemBySlot(EquipmentSlot.MAINHAND).isEmpty();
             } else {
-                this.panda.setTarget(null);
                 return false;
             }
         }
 
         @Override
-        protected void alertOther(Mob mob, LivingEntity target) {
-            if (mob instanceof Panda && mob.isAggressive()) {
-                mob.setTarget(target);
+        public boolean canContinueToUse() {
+            return !Panda.this.isInWater() && (Panda.this.isLazy() || Panda.this.random.nextInt(reducedTickDelay(600)) != 1) ? Panda.this.random.nextInt(reducedTickDelay(2000)) != 1 : false;
+        }
+
+        @Override
+        public void tick() {
+            if (!Panda.this.isSitting() && !Panda.this.getItemBySlot(EquipmentSlot.MAINHAND).isEmpty()) {
+                Panda.this.tryToSit();
+            }
+
+        }
+
+        @Override
+        public void start() {
+            List<ItemEntity> list = Panda.this.level().getEntitiesOfClass(ItemEntity.class, Panda.this.getBoundingBox().inflate(8.0D, 8.0D, 8.0D), Panda.PANDA_ITEMS);
+
+            if (!list.isEmpty() && Panda.this.getItemBySlot(EquipmentSlot.MAINHAND).isEmpty()) {
+                Panda.this.getNavigation().moveTo((Entity) list.get(0), 1.2000000476837158D);
+            } else if (!Panda.this.getItemBySlot(EquipmentSlot.MAINHAND).isEmpty()) {
+                Panda.this.tryToSit();
+            }
+
+            this.cooldown = 0;
+        }
+
+        @Override
+        public void stop() {
+            ItemStack itemstack = Panda.this.getItemBySlot(EquipmentSlot.MAINHAND);
+
+            if (!itemstack.isEmpty()) {
+                Panda.this.forceDrops = true; // Paper - Add missing forceDrop toggles
+                Panda.this.spawnAtLocation(itemstack);
+                Panda.this.forceDrops = false; // Paper - Add missing forceDrop toggles
+                Panda.this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY);
+                int i = Panda.this.isLazy() ? Panda.this.random.nextInt(50) + 10 : Panda.this.random.nextInt(150) + 10;
+
+                this.cooldown = Panda.this.tickCount + i * 20;
             }
+
+            Panda.this.sit(false);
         }
     }
 
-    static class PandaLieOnBackGoal extends Goal {
+    private static class PandaLieOnBackGoal extends Goal {
+
         private final Panda panda;
         private int cooldown;
 
@@ -898,17 +989,12 @@
 
         @Override
         public boolean canUse() {
-            return this.cooldown < this.panda.tickCount
-                && this.panda.isLazy()
-                && this.panda.canPerformAction()
-                && this.panda.random.nextInt(reducedTickDelay(400)) == 1;
+            return this.cooldown < this.panda.tickCount && this.panda.isLazy() && this.panda.canPerformAction() && this.panda.random.nextInt(reducedTickDelay(400)) == 1;
         }
 
         @Override
         public boolean canContinueToUse() {
-            return !this.panda.isInWater()
-                && (this.panda.isLazy() || this.panda.random.nextInt(reducedTickDelay(600)) != 1)
-                && this.panda.random.nextInt(reducedTickDelay(2000)) != 1;
+            return !this.panda.isInWater() && (this.panda.isLazy() || this.panda.random.nextInt(reducedTickDelay(600)) != 1) ? this.panda.random.nextInt(reducedTickDelay(2000)) != 1 : false;
         }
 
         @Override
@@ -924,7 +1010,32 @@
         }
     }
 
-    static class PandaLookAtPlayerGoal extends LookAtPlayerGoal {
+    private static class PandaSneezeGoal extends Goal {
+
+        private final Panda panda;
+
+        public PandaSneezeGoal(Panda panda) {
+            this.panda = panda;
+        }
+
+        @Override
+        public boolean canUse() {
+            return this.panda.isBaby() && this.panda.canPerformAction() ? (this.panda.isWeak() && this.panda.random.nextInt(reducedTickDelay(500)) == 1 ? true : this.panda.random.nextInt(reducedTickDelay(6000)) == 1) : false;
+        }
+
+        @Override
+        public boolean canContinueToUse() {
+            return false;
+        }
+
+        @Override
+        public void start() {
+            this.panda.sneeze(true);
+        }
+    }
+
+    private static class PandaLookAtPlayerGoal extends LookAtPlayerGoal {
+
         private final Panda panda;
 
         public PandaLookAtPlayerGoal(Panda panda, Class<? extends LivingEntity> targetType, float range) {
@@ -950,22 +1061,9 @@
                     if (this.lookAtType == Player.class) {
                         this.lookAt = this.mob.level().getNearestPlayer(this.lookAtContext, this.mob, this.mob.getX(), this.mob.getEyeY(), this.mob.getZ());
                     } else {
-                        this.lookAt = this.mob
-                            .level()
-                            .getNearestEntity(
-                                this.mob
-                                    .level()
-                                    .getEntitiesOfClass(
-                                        this.lookAtType,
-                                        this.mob.getBoundingBox().inflate((double)this.lookDistance, 3.0, (double)this.lookDistance),
-                                        livingEntity -> true
-                                    ),
-                                this.lookAtContext,
-                                this.mob,
-                                this.mob.getX(),
-                                this.mob.getEyeY(),
-                                this.mob.getZ()
-                            );
+                        this.lookAt = this.mob.level().getNearestEntity(this.mob.level().getEntitiesOfClass(this.lookAtType, this.mob.getBoundingBox().inflate((double) this.lookDistance, 3.0D, (double) this.lookDistance), (entityliving) -> {
+                            return true;
+                        }), this.lookAtContext, this.mob, this.mob.getX(), this.mob.getEyeY(), this.mob.getZ());
                     }
                 }
 
@@ -978,45 +1076,12 @@
             if (this.lookAt != null) {
                 super.tick();
             }
-        }
-    }
-
-    static class PandaMoveControl extends MoveControl {
-        private final Panda panda;
-
-        public PandaMoveControl(Panda panda) {
-            super(panda);
-            this.panda = panda;
-        }
 
-        @Override
-        public void tick() {
-            if (this.panda.canPerformAction()) {
-                super.tick();
-            }
         }
     }
 
-    static class PandaPanicGoal extends PanicGoal {
-        private final Panda panda;
-
-        public PandaPanicGoal(Panda panda, double speed) {
-            super(panda, speed, DamageTypeTags.PANIC_ENVIRONMENTAL_CAUSES);
-            this.panda = panda;
-        }
-
-        @Override
-        public boolean canContinueToUse() {
-            if (this.panda.isSitting()) {
-                this.panda.getNavigation().stop();
-                return false;
-            } else {
-                return super.canContinueToUse();
-            }
-        }
-    }
+    private static class PandaRollGoal extends Goal {
 
-    static class PandaRollGoal extends Goal {
         private final Panda panda;
 
         public PandaRollGoal(Panda panda) {
@@ -1030,14 +1095,13 @@
                 if (!this.panda.canPerformAction()) {
                     return false;
                 } else {
-                    float f = this.panda.getYRot() * (float) (Math.PI / 180.0);
-                    float g = -Mth.sin(f);
-                    float h = Mth.cos(f);
-                    int i = (double)Math.abs(g) > 0.5 ? Mth.sign((double)g) : 0;
-                    int j = (double)Math.abs(h) > 0.5 ? Mth.sign((double)h) : 0;
-                    return this.panda.level().getBlockState(this.panda.blockPosition().offset(i, -1, j)).isAir()
-                        || this.panda.isPlayful() && this.panda.random.nextInt(reducedTickDelay(60)) == 1
-                        || this.panda.random.nextInt(reducedTickDelay(500)) == 1;
+                    float f = this.panda.getYRot() * 0.017453292F;
+                    float f1 = -Mth.sin(f);
+                    float f2 = Mth.cos(f);
+                    int i = (double) Math.abs(f1) > 0.5D ? Mth.sign((double) f1) : 0;
+                    int j = (double) Math.abs(f2) > 0.5D ? Mth.sign((double) f2) : 0;
+
+                    return this.panda.level().getBlockState(this.panda.blockPosition().offset(i, -1, j)).isAir() ? true : (this.panda.isPlayful() && this.panda.random.nextInt(reducedTickDelay(60)) == 1 ? true : this.panda.random.nextInt(reducedTickDelay(500)) == 1);
                 }
             } else {
                 return false;
@@ -1060,91 +1124,31 @@
         }
     }
 
-    class PandaSitGoal extends Goal {
-        private int cooldown;
+    private static class PandaHurtByTargetGoal extends HurtByTargetGoal {
 
-        public PandaSitGoal() {
-            this.setFlags(EnumSet.of(Goal.Flag.MOVE));
-        }
+        private final Panda panda;
 
-        @Override
-        public boolean canUse() {
-            if (this.cooldown <= Panda.this.tickCount
-                && !Panda.this.isBaby()
-                && !Panda.this.isInWater()
-                && Panda.this.canPerformAction()
-                && Panda.this.getUnhappyCounter() <= 0) {
-                List<ItemEntity> list = Panda.this.level()
-                    .getEntitiesOfClass(ItemEntity.class, Panda.this.getBoundingBox().inflate(6.0, 6.0, 6.0), Panda.PANDA_ITEMS);
-                return !list.isEmpty() || !Panda.this.getItemBySlot(EquipmentSlot.MAINHAND).isEmpty();
-            } else {
-                return false;
-            }
+        public PandaHurtByTargetGoal(Panda panda, Class<?>... noRevengeTypes) {
+            super(panda, noRevengeTypes);
+            this.panda = panda;
         }
 
         @Override
         public boolean canContinueToUse() {
-            return !Panda.this.isInWater()
-                && (Panda.this.isLazy() || Panda.this.random.nextInt(reducedTickDelay(600)) != 1)
-                && Panda.this.random.nextInt(reducedTickDelay(2000)) != 1;
-        }
-
-        @Override
-        public void tick() {
-            if (!Panda.this.isSitting() && !Panda.this.getItemBySlot(EquipmentSlot.MAINHAND).isEmpty()) {
-                Panda.this.tryToSit();
-            }
-        }
-
-        @Override
-        public void start() {
-            List<ItemEntity> list = Panda.this.level()
-                .getEntitiesOfClass(ItemEntity.class, Panda.this.getBoundingBox().inflate(8.0, 8.0, 8.0), Panda.PANDA_ITEMS);
-            if (!list.isEmpty() && Panda.this.getItemBySlot(EquipmentSlot.MAINHAND).isEmpty()) {
-                Panda.this.getNavigation().moveTo(list.get(0), 1.2F);
-            } else if (!Panda.this.getItemBySlot(EquipmentSlot.MAINHAND).isEmpty()) {
-                Panda.this.tryToSit();
+            if (!this.panda.gotBamboo && !this.panda.didBite) {
+                return super.canContinueToUse();
+            } else {
+                this.panda.setTarget((LivingEntity) null);
+                return false;
             }
-
-            this.cooldown = 0;
         }
 
         @Override
-        public void stop() {
-            ItemStack itemStack = Panda.this.getItemBySlot(EquipmentSlot.MAINHAND);
-            if (!itemStack.isEmpty()) {
-                Panda.this.spawnAtLocation(itemStack);
-                Panda.this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY);
-                int i = Panda.this.isLazy() ? Panda.this.random.nextInt(50) + 10 : Panda.this.random.nextInt(150) + 10;
-                this.cooldown = Panda.this.tickCount + i * 20;
+        protected void alertOther(Mob mob, LivingEntity target) {
+            if (mob instanceof Panda && mob.isAggressive()) {
+                mob.setTarget(target, EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true); // CraftBukkit
             }
 
-            Panda.this.sit(false);
-        }
-    }
-
-    static class PandaSneezeGoal extends Goal {
-        private final Panda panda;
-
-        public PandaSneezeGoal(Panda panda) {
-            this.panda = panda;
-        }
-
-        @Override
-        public boolean canUse() {
-            return this.panda.isBaby()
-                && this.panda.canPerformAction()
-                && (this.panda.isWeak() && this.panda.random.nextInt(reducedTickDelay(500)) == 1 || this.panda.random.nextInt(reducedTickDelay(6000)) == 1);
-        }
-
-        @Override
-        public boolean canContinueToUse() {
-            return false;
-        }
-
-        @Override
-        public void start() {
-            this.panda.sneeze(true);
         }
     }
 }
