--- a/net/minecraft/world/entity/animal/Parrot.java
+++ b/net/minecraft/world/entity/animal/Parrot.java
@@ -3,6 +3,7 @@
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.mojang.serialization.Codec;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.function.IntFunction;
@@ -66,50 +67,50 @@
 import net.minecraft.world.phys.Vec3;
 
 public class Parrot extends ShoulderRidingEntity implements VariantHolder<Parrot.Variant>, FlyingAnimal {
+
     private static final EntityDataAccessor<Integer> DATA_VARIANT_ID = SynchedEntityData.defineId(Parrot.class, EntityDataSerializers.INT);
     private static final Predicate<Mob> NOT_PARROT_PREDICATE = new Predicate<Mob>() {
-        @Override
-        public boolean test(@Nullable Mob mob) {
-            return mob != null && Parrot.MOB_SOUND_MAP.containsKey(mob.getType());
+        public boolean test(@Nullable Mob entityinsentient) {
+            return entityinsentient != null && Parrot.MOB_SOUND_MAP.containsKey(entityinsentient.getType());
         }
     };
-    static final Map<EntityType<?>, SoundEvent> MOB_SOUND_MAP = Util.make(Maps.newHashMap(), map -> {
-        map.put(EntityType.BLAZE, SoundEvents.PARROT_IMITATE_BLAZE);
-        map.put(EntityType.BOGGED, SoundEvents.PARROT_IMITATE_BOGGED);
-        map.put(EntityType.BREEZE, SoundEvents.PARROT_IMITATE_BREEZE);
-        map.put(EntityType.CAVE_SPIDER, SoundEvents.PARROT_IMITATE_SPIDER);
-        map.put(EntityType.CREEPER, SoundEvents.PARROT_IMITATE_CREEPER);
-        map.put(EntityType.DROWNED, SoundEvents.PARROT_IMITATE_DROWNED);
-        map.put(EntityType.ELDER_GUARDIAN, SoundEvents.PARROT_IMITATE_ELDER_GUARDIAN);
-        map.put(EntityType.ENDER_DRAGON, SoundEvents.PARROT_IMITATE_ENDER_DRAGON);
-        map.put(EntityType.ENDERMITE, SoundEvents.PARROT_IMITATE_ENDERMITE);
-        map.put(EntityType.EVOKER, SoundEvents.PARROT_IMITATE_EVOKER);
-        map.put(EntityType.GHAST, SoundEvents.PARROT_IMITATE_GHAST);
-        map.put(EntityType.GUARDIAN, SoundEvents.PARROT_IMITATE_GUARDIAN);
-        map.put(EntityType.HOGLIN, SoundEvents.PARROT_IMITATE_HOGLIN);
-        map.put(EntityType.HUSK, SoundEvents.PARROT_IMITATE_HUSK);
-        map.put(EntityType.ILLUSIONER, SoundEvents.PARROT_IMITATE_ILLUSIONER);
-        map.put(EntityType.MAGMA_CUBE, SoundEvents.PARROT_IMITATE_MAGMA_CUBE);
-        map.put(EntityType.PHANTOM, SoundEvents.PARROT_IMITATE_PHANTOM);
-        map.put(EntityType.PIGLIN, SoundEvents.PARROT_IMITATE_PIGLIN);
-        map.put(EntityType.PIGLIN_BRUTE, SoundEvents.PARROT_IMITATE_PIGLIN_BRUTE);
-        map.put(EntityType.PILLAGER, SoundEvents.PARROT_IMITATE_PILLAGER);
-        map.put(EntityType.RAVAGER, SoundEvents.PARROT_IMITATE_RAVAGER);
-        map.put(EntityType.SHULKER, SoundEvents.PARROT_IMITATE_SHULKER);
-        map.put(EntityType.SILVERFISH, SoundEvents.PARROT_IMITATE_SILVERFISH);
-        map.put(EntityType.SKELETON, SoundEvents.PARROT_IMITATE_SKELETON);
-        map.put(EntityType.SLIME, SoundEvents.PARROT_IMITATE_SLIME);
-        map.put(EntityType.SPIDER, SoundEvents.PARROT_IMITATE_SPIDER);
-        map.put(EntityType.STRAY, SoundEvents.PARROT_IMITATE_STRAY);
-        map.put(EntityType.VEX, SoundEvents.PARROT_IMITATE_VEX);
-        map.put(EntityType.VINDICATOR, SoundEvents.PARROT_IMITATE_VINDICATOR);
-        map.put(EntityType.WARDEN, SoundEvents.PARROT_IMITATE_WARDEN);
-        map.put(EntityType.WITCH, SoundEvents.PARROT_IMITATE_WITCH);
-        map.put(EntityType.WITHER, SoundEvents.PARROT_IMITATE_WITHER);
-        map.put(EntityType.WITHER_SKELETON, SoundEvents.PARROT_IMITATE_WITHER_SKELETON);
-        map.put(EntityType.ZOGLIN, SoundEvents.PARROT_IMITATE_ZOGLIN);
-        map.put(EntityType.ZOMBIE, SoundEvents.PARROT_IMITATE_ZOMBIE);
-        map.put(EntityType.ZOMBIE_VILLAGER, SoundEvents.PARROT_IMITATE_ZOMBIE_VILLAGER);
+    static final Map<EntityType<?>, SoundEvent> MOB_SOUND_MAP = (Map) Util.make(Maps.newHashMap(), (hashmap) -> {
+        hashmap.put(EntityType.BLAZE, SoundEvents.PARROT_IMITATE_BLAZE);
+        hashmap.put(EntityType.BOGGED, SoundEvents.PARROT_IMITATE_BOGGED);
+        hashmap.put(EntityType.BREEZE, SoundEvents.PARROT_IMITATE_BREEZE);
+        hashmap.put(EntityType.CAVE_SPIDER, SoundEvents.PARROT_IMITATE_SPIDER);
+        hashmap.put(EntityType.CREEPER, SoundEvents.PARROT_IMITATE_CREEPER);
+        hashmap.put(EntityType.DROWNED, SoundEvents.PARROT_IMITATE_DROWNED);
+        hashmap.put(EntityType.ELDER_GUARDIAN, SoundEvents.PARROT_IMITATE_ELDER_GUARDIAN);
+        hashmap.put(EntityType.ENDER_DRAGON, SoundEvents.PARROT_IMITATE_ENDER_DRAGON);
+        hashmap.put(EntityType.ENDERMITE, SoundEvents.PARROT_IMITATE_ENDERMITE);
+        hashmap.put(EntityType.EVOKER, SoundEvents.PARROT_IMITATE_EVOKER);
+        hashmap.put(EntityType.GHAST, SoundEvents.PARROT_IMITATE_GHAST);
+        hashmap.put(EntityType.GUARDIAN, SoundEvents.PARROT_IMITATE_GUARDIAN);
+        hashmap.put(EntityType.HOGLIN, SoundEvents.PARROT_IMITATE_HOGLIN);
+        hashmap.put(EntityType.HUSK, SoundEvents.PARROT_IMITATE_HUSK);
+        hashmap.put(EntityType.ILLUSIONER, SoundEvents.PARROT_IMITATE_ILLUSIONER);
+        hashmap.put(EntityType.MAGMA_CUBE, SoundEvents.PARROT_IMITATE_MAGMA_CUBE);
+        hashmap.put(EntityType.PHANTOM, SoundEvents.PARROT_IMITATE_PHANTOM);
+        hashmap.put(EntityType.PIGLIN, SoundEvents.PARROT_IMITATE_PIGLIN);
+        hashmap.put(EntityType.PIGLIN_BRUTE, SoundEvents.PARROT_IMITATE_PIGLIN_BRUTE);
+        hashmap.put(EntityType.PILLAGER, SoundEvents.PARROT_IMITATE_PILLAGER);
+        hashmap.put(EntityType.RAVAGER, SoundEvents.PARROT_IMITATE_RAVAGER);
+        hashmap.put(EntityType.SHULKER, SoundEvents.PARROT_IMITATE_SHULKER);
+        hashmap.put(EntityType.SILVERFISH, SoundEvents.PARROT_IMITATE_SILVERFISH);
+        hashmap.put(EntityType.SKELETON, SoundEvents.PARROT_IMITATE_SKELETON);
+        hashmap.put(EntityType.SLIME, SoundEvents.PARROT_IMITATE_SLIME);
+        hashmap.put(EntityType.SPIDER, SoundEvents.PARROT_IMITATE_SPIDER);
+        hashmap.put(EntityType.STRAY, SoundEvents.PARROT_IMITATE_STRAY);
+        hashmap.put(EntityType.VEX, SoundEvents.PARROT_IMITATE_VEX);
+        hashmap.put(EntityType.VINDICATOR, SoundEvents.PARROT_IMITATE_VINDICATOR);
+        hashmap.put(EntityType.WARDEN, SoundEvents.PARROT_IMITATE_WARDEN);
+        hashmap.put(EntityType.WITCH, SoundEvents.PARROT_IMITATE_WITCH);
+        hashmap.put(EntityType.WITHER, SoundEvents.PARROT_IMITATE_WITHER);
+        hashmap.put(EntityType.WITHER_SKELETON, SoundEvents.PARROT_IMITATE_WITHER_SKELETON);
+        hashmap.put(EntityType.ZOGLIN, SoundEvents.PARROT_IMITATE_ZOGLIN);
+        hashmap.put(EntityType.ZOMBIE, SoundEvents.PARROT_IMITATE_ZOMBIE);
+        hashmap.put(EntityType.ZOMBIE_VILLAGER, SoundEvents.PARROT_IMITATE_ZOMBIE_VILLAGER);
     });
     public float flap;
     public float flapSpeed;
@@ -132,12 +133,12 @@
     @Nullable
     @Override
     public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, @Nullable SpawnGroupData entityData) {
-        this.setVariant(Util.getRandom(Parrot.Variant.values(), world.getRandom()));
+        this.setVariant((Parrot.Variant) Util.getRandom((Object[]) Parrot.Variant.values(), world.getRandom()));
         if (entityData == null) {
             entityData = new AgeableMob.AgeableMobGroupData(false);
         }
 
-        return super.finalizeSpawn(world, difficulty, spawnReason, entityData);
+        return super.finalizeSpawn(world, difficulty, spawnReason, (SpawnGroupData) entityData);
     }
 
     @Override
@@ -147,42 +148,39 @@
 
     @Override
     protected void registerGoals() {
-        this.goalSelector.addGoal(0, new TamableAnimal.TamableAnimalPanicGoal(1.25));
+        this.goalSelector.addGoal(0, new TamableAnimal.TamableAnimalPanicGoal(1.25D));
         this.goalSelector.addGoal(0, new FloatGoal(this));
         this.goalSelector.addGoal(1, new LookAtPlayerGoal(this, Player.class, 8.0F));
         this.goalSelector.addGoal(2, new SitWhenOrderedToGoal(this));
-        this.goalSelector.addGoal(2, new FollowOwnerGoal(this, 1.0, 5.0F, 1.0F));
-        this.goalSelector.addGoal(2, new Parrot.ParrotWanderGoal(this, 1.0));
+        this.goalSelector.addGoal(2, new FollowOwnerGoal(this, 1.0D, 5.0F, 1.0F));
+        this.goalSelector.addGoal(2, new Parrot.ParrotWanderGoal(this, 1.0D));
         this.goalSelector.addGoal(3, new LandOnOwnersShoulderGoal(this));
-        this.goalSelector.addGoal(3, new FollowMobGoal(this, 1.0, 3.0F, 7.0F));
+        this.goalSelector.addGoal(3, new FollowMobGoal(this, 1.0D, 3.0F, 7.0F));
     }
 
     public static AttributeSupplier.Builder createAttributes() {
-        return Mob.createMobAttributes()
-            .add(Attributes.MAX_HEALTH, 6.0)
-            .add(Attributes.FLYING_SPEED, 0.4F)
-            .add(Attributes.MOVEMENT_SPEED, 0.2F)
-            .add(Attributes.ATTACK_DAMAGE, 3.0);
+        return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 6.0D).add(Attributes.FLYING_SPEED, 0.4000000059604645D).add(Attributes.MOVEMENT_SPEED, 0.20000000298023224D).add(Attributes.ATTACK_DAMAGE, 3.0D);
     }
 
     @Override
     protected PathNavigation createNavigation(Level world) {
-        FlyingPathNavigation flyingPathNavigation = new FlyingPathNavigation(this, world);
-        flyingPathNavigation.setCanOpenDoors(false);
-        flyingPathNavigation.setCanFloat(true);
-        flyingPathNavigation.setCanPassDoors(true);
-        return flyingPathNavigation;
+        FlyingPathNavigation navigationflying = new FlyingPathNavigation(this, world);
+
+        navigationflying.setCanOpenDoors(false);
+        navigationflying.setCanFloat(true);
+        navigationflying.setCanPassDoors(true);
+        return navigationflying;
     }
 
     @Override
     public void aiStep() {
-        if (this.jukebox == null || !this.jukebox.closerToCenterThan(this.position(), 3.46) || !this.level().getBlockState(this.jukebox).is(Blocks.JUKEBOX)) {
+        if (this.jukebox == null || !this.jukebox.closerToCenterThan(this.position(), 3.46D) || !this.level().getBlockState(this.jukebox).is(Blocks.JUKEBOX)) {
             this.partyParrot = false;
             this.jukebox = null;
         }
 
         if (this.level().random.nextInt(400) == 0) {
-            imitateNearbyMobs(this.level(), this);
+            Parrot.imitateNearbyMobs(this.level(), this);
         }
 
         super.aiStep();
@@ -202,29 +200,33 @@
     private void calculateFlapping() {
         this.oFlap = this.flap;
         this.oFlapSpeed = this.flapSpeed;
-        this.flapSpeed = this.flapSpeed + (float)(!this.onGround() && !this.isPassenger() ? 4 : -1) * 0.3F;
+        this.flapSpeed += (float) (!this.onGround() && !this.isPassenger() ? 4 : -1) * 0.3F;
         this.flapSpeed = Mth.clamp(this.flapSpeed, 0.0F, 1.0F);
         if (!this.onGround() && this.flapping < 1.0F) {
             this.flapping = 1.0F;
         }
 
         this.flapping *= 0.9F;
-        Vec3 vec3 = this.getDeltaMovement();
-        if (!this.onGround() && vec3.y < 0.0) {
-            this.setDeltaMovement(vec3.multiply(1.0, 0.6, 1.0));
+        Vec3 vec3d = this.getDeltaMovement();
+
+        if (!this.onGround() && vec3d.y < 0.0D) {
+            this.setDeltaMovement(vec3d.multiply(1.0D, 0.6D, 1.0D));
         }
 
-        this.flap = this.flap + this.flapping * 2.0F;
+        this.flap += this.flapping * 2.0F;
     }
 
     public static boolean imitateNearbyMobs(Level world, Entity parrot) {
         if (parrot.isAlive() && !parrot.isSilent() && world.random.nextInt(2) == 0) {
-            List<Mob> list = world.getEntitiesOfClass(Mob.class, parrot.getBoundingBox().inflate(20.0), NOT_PARROT_PREDICATE);
+            List<Mob> list = world.getEntitiesOfClass(Mob.class, parrot.getBoundingBox().inflate(20.0D), Parrot.NOT_PARROT_PREDICATE);
+
             if (!list.isEmpty()) {
-                Mob mob = list.get(world.random.nextInt(list.size()));
-                if (!mob.isSilent()) {
-                    SoundEvent soundEvent = getImitatedSound(mob.getType());
-                    world.playSound(null, parrot.getX(), parrot.getY(), parrot.getZ(), soundEvent, parrot.getSoundSource(), 0.7F, getPitch(world.random));
+                Mob entityinsentient = (Mob) list.get(world.random.nextInt(list.size()));
+
+                if (!entityinsentient.isSilent()) {
+                    SoundEvent soundeffect = Parrot.getImitatedSound(entityinsentient.getType());
+
+                    world.playSound((Player) null, parrot.getX(), parrot.getY(), parrot.getZ(), soundeffect, parrot.getSoundSource(), 0.7F, Parrot.getPitch(world.random));
                     return true;
                 }
             }
@@ -237,34 +239,25 @@
 
     @Override
     public InteractionResult mobInteract(Player player, InteractionHand hand) {
-        ItemStack itemStack = player.getItemInHand(hand);
-        if (!this.isTame() && itemStack.is(ItemTags.PARROT_FOOD)) {
-            itemStack.consume(1, player);
+        ItemStack itemstack = player.getItemInHand(hand);
+
+        if (!this.isTame() && itemstack.is(ItemTags.PARROT_FOOD)) {
+            itemstack.consume(1, player);
             if (!this.isSilent()) {
-                this.level()
-                    .playSound(
-                        null,
-                        this.getX(),
-                        this.getY(),
-                        this.getZ(),
-                        SoundEvents.PARROT_EAT,
-                        this.getSoundSource(),
-                        1.0F,
-                        1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.2F
-                    );
+                this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PARROT_EAT, this.getSoundSource(), 1.0F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.2F);
             }
 
             if (!this.level().isClientSide) {
-                if (this.random.nextInt(10) == 0) {
+                if (this.random.nextInt(10) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, player).isCancelled()) { // CraftBukkit
                     this.tame(player);
-                    this.level().broadcastEntityEvent(this, (byte)7);
+                    this.level().broadcastEntityEvent(this, (byte) 7);
                 } else {
-                    this.level().broadcastEntityEvent(this, (byte)6);
+                    this.level().broadcastEntityEvent(this, (byte) 6);
                 }
             }
 
             return InteractionResult.sidedSuccess(this.level().isClientSide);
-        } else if (!itemStack.is(ItemTags.PARROT_POISONOUS_FOOD)) {
+        } else if (!itemstack.is(ItemTags.PARROT_POISONOUS_FOOD)) {
             if (!this.isFlying() && this.isTame() && this.isOwnedBy(player)) {
                 if (!this.level().isClientSide) {
                     this.setOrderedToSit(!this.isOrderedToSit());
@@ -275,8 +268,8 @@
                 return super.mobInteract(player, hand);
             }
         } else {
-            itemStack.consume(1, player);
-            this.addEffect(new MobEffectInstance(MobEffects.POISON, 900));
+            itemstack.consume(1, player);
+            this.addEffect(new MobEffectInstance(MobEffects.POISON, 900), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.FOOD); // CraftBukkit
             if (player.isCreative() || !this.isInvulnerable()) {
                 this.hurt(this.damageSources().playerAttack(player), Float.MAX_VALUE);
             }
@@ -295,8 +288,7 @@
     }
 
     @Override
-    protected void checkFallDamage(double heightDifference, boolean onGround, BlockState state, BlockPos landedPosition) {
-    }
+    protected void checkFallDamage(double heightDifference, boolean onGround, BlockState state, BlockPos landedPosition) {}
 
     @Override
     public boolean canMate(Animal other) {
@@ -312,20 +304,21 @@
     @Nullable
     @Override
     public SoundEvent getAmbientSound() {
-        return getAmbient(this.level(), this.level().random);
+        return Parrot.getAmbient(this.level(), this.level().random);
     }
 
     public static SoundEvent getAmbient(Level world, RandomSource random) {
         if (world.getDifficulty() != Difficulty.PEACEFUL && random.nextInt(1000) == 0) {
-            List<EntityType<?>> list = Lists.newArrayList(MOB_SOUND_MAP.keySet());
-            return getImitatedSound(list.get(random.nextInt(list.size())));
+            List<EntityType<?>> list = Lists.newArrayList(Parrot.MOB_SOUND_MAP.keySet());
+
+            return Parrot.getImitatedSound((EntityType) list.get(random.nextInt(list.size())));
         } else {
             return SoundEvents.PARROT_AMBIENT;
         }
     }
 
     private static SoundEvent getImitatedSound(EntityType<?> imitate) {
-        return MOB_SOUND_MAP.getOrDefault(imitate, SoundEvents.PARROT_AMBIENT);
+        return (SoundEvent) Parrot.MOB_SOUND_MAP.getOrDefault(imitate, SoundEvents.PARROT_AMBIENT);
     }
 
     @Override
@@ -356,7 +349,7 @@
 
     @Override
     public float getVoicePitch() {
-        return getPitch(this.random);
+        return Parrot.getPitch(this.random);
     }
 
     public static float getPitch(RandomSource random) {
@@ -369,8 +362,8 @@
     }
 
     @Override
-    public boolean isPushable() {
-        return true;
+    public boolean isCollidable(boolean ignoreClimbing) { // Paper - Climbing should not bypass cramming gamerule
+        return super.isCollidable(ignoreClimbing); // CraftBukkit - collidable API // Paper - Climbing should not bypass cramming gamerule
     }
 
     @Override
@@ -385,28 +378,30 @@
         if (this.isInvulnerableTo(source)) {
             return false;
         } else {
-            if (!this.level().isClientSide) {
+            // CraftBukkit start
+            boolean result = super.hurt(source, amount);
+            if (!this.level().isClientSide && result) {
+                // CraftBukkit end
                 this.setOrderedToSit(false);
             }
 
-            return super.hurt(source, amount);
+            return result; // CraftBukkit
         }
     }
 
     @Override
     public Parrot.Variant getVariant() {
-        return Parrot.Variant.byId(this.entityData.get(DATA_VARIANT_ID));
+        return Parrot.Variant.byId((Integer) this.entityData.get(Parrot.DATA_VARIANT_ID));
     }
 
-    @Override
     public void setVariant(Parrot.Variant variant) {
-        this.entityData.set(DATA_VARIANT_ID, variant.id);
+        this.entityData.set(Parrot.DATA_VARIANT_ID, variant.id);
     }
 
     @Override
     protected void defineSynchedData(SynchedEntityData.Builder builder) {
         super.defineSynchedData(builder);
-        builder.define(DATA_VARIANT_ID, 0);
+        builder.define(Parrot.DATA_VARIANT_ID, 0);
     }
 
     @Override
@@ -433,10 +428,39 @@
 
     @Override
     public Vec3 getLeashOffset() {
-        return new Vec3(0.0, (double)(0.5F * this.getEyeHeight()), (double)(this.getBbWidth() * 0.4F));
+        return new Vec3(0.0D, (double) (0.5F * this.getEyeHeight()), (double) (this.getBbWidth() * 0.4F));
     }
 
-    static class ParrotWanderGoal extends WaterAvoidingRandomFlyingGoal {
+    public static enum Variant implements StringRepresentable {
+
+        RED_BLUE(0, "red_blue"), BLUE(1, "blue"), GREEN(2, "green"), YELLOW_BLUE(3, "yellow_blue"), GRAY(4, "gray");
+
+        public static final Codec<Parrot.Variant> CODEC = StringRepresentable.fromEnum(Parrot.Variant::values);
+        private static final IntFunction<Parrot.Variant> BY_ID = ByIdMap.continuous(Parrot.Variant::getId, values(), ByIdMap.OutOfBoundsStrategy.CLAMP);
+        final int id;
+        private final String name;
+
+        private Variant(final int i, final String s) {
+            this.id = i;
+            this.name = s;
+        }
+
+        public int getId() {
+            return this.id;
+        }
+
+        public static Parrot.Variant byId(int index) {
+            return (Parrot.Variant) Parrot.Variant.BY_ID.apply(index);
+        }
+
+        @Override
+        public String getSerializedName() {
+            return this.name;
+        }
+    }
+
+    private static class ParrotWanderGoal extends WaterAvoidingRandomFlyingGoal {
+
         public ParrotWanderGoal(PathfinderMob mob, double speed) {
             super(mob, speed);
         }
@@ -444,39 +468,36 @@
         @Nullable
         @Override
         protected Vec3 getPosition() {
-            Vec3 vec3 = null;
+            Vec3 vec3d = null;
+
             if (this.mob.isInWater()) {
-                vec3 = LandRandomPos.getPos(this.mob, 15, 15);
+                vec3d = LandRandomPos.getPos(this.mob, 15, 15);
             }
 
             if (this.mob.getRandom().nextFloat() >= this.probability) {
-                vec3 = this.getTreePos();
+                vec3d = this.getTreePos();
             }
 
-            return vec3 == null ? super.getPosition() : vec3;
+            return vec3d == null ? super.getPosition() : vec3d;
         }
 
         @Nullable
         private Vec3 getTreePos() {
-            BlockPos blockPos = this.mob.blockPosition();
-            BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
-            BlockPos.MutableBlockPos mutableBlockPos2 = new BlockPos.MutableBlockPos();
+            BlockPos blockposition = this.mob.blockPosition();
+            BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
+            BlockPos.MutableBlockPos blockposition_mutableblockposition1 = new BlockPos.MutableBlockPos();
+            Iterable<BlockPos> iterable = BlockPos.betweenClosed(Mth.floor(this.mob.getX() - 3.0D), Mth.floor(this.mob.getY() - 6.0D), Mth.floor(this.mob.getZ() - 3.0D), Mth.floor(this.mob.getX() + 3.0D), Mth.floor(this.mob.getY() + 6.0D), Mth.floor(this.mob.getZ() + 3.0D));
+            Iterator iterator = iterable.iterator();
 
-            for (BlockPos blockPos2 : BlockPos.betweenClosed(
-                Mth.floor(this.mob.getX() - 3.0),
-                Mth.floor(this.mob.getY() - 6.0),
-                Mth.floor(this.mob.getZ() - 3.0),
-                Mth.floor(this.mob.getX() + 3.0),
-                Mth.floor(this.mob.getY() + 6.0),
-                Mth.floor(this.mob.getZ() + 3.0)
-            )) {
-                if (!blockPos.equals(blockPos2)) {
-                    BlockState blockState = this.mob.level().getBlockState(mutableBlockPos2.setWithOffset(blockPos2, Direction.DOWN));
-                    boolean bl = blockState.getBlock() instanceof LeavesBlock || blockState.is(BlockTags.LOGS);
-                    if (bl && this.mob.level().isEmptyBlock(blockPos2) && this.mob.level().isEmptyBlock(mutableBlockPos.setWithOffset(blockPos2, Direction.UP))
-                        )
-                     {
-                        return Vec3.atBottomCenterOf(blockPos2);
+            while (iterator.hasNext()) {
+                BlockPos blockposition1 = (BlockPos) iterator.next();
+
+                if (!blockposition.equals(blockposition1)) {
+                    BlockState iblockdata = this.mob.level().getBlockState(blockposition_mutableblockposition1.setWithOffset(blockposition1, Direction.DOWN));
+                    boolean flag = iblockdata.getBlock() instanceof LeavesBlock || iblockdata.is(BlockTags.LOGS);
+
+                    if (flag && this.mob.level().isEmptyBlock(blockposition1) && this.mob.level().isEmptyBlock(blockposition_mutableblockposition.setWithOffset(blockposition1, Direction.UP))) {
+                        return Vec3.atBottomCenterOf(blockposition1);
                     }
                 }
             }
@@ -484,35 +505,4 @@
             return null;
         }
     }
-
-    public static enum Variant implements StringRepresentable {
-        RED_BLUE(0, "red_blue"),
-        BLUE(1, "blue"),
-        GREEN(2, "green"),
-        YELLOW_BLUE(3, "yellow_blue"),
-        GRAY(4, "gray");
-
-        public static final Codec<Parrot.Variant> CODEC = StringRepresentable.fromEnum(Parrot.Variant::values);
-        private static final IntFunction<Parrot.Variant> BY_ID = ByIdMap.continuous(Parrot.Variant::getId, values(), ByIdMap.OutOfBoundsStrategy.CLAMP);
-        final int id;
-        private final String name;
-
-        private Variant(final int id, final String name) {
-            this.id = id;
-            this.name = name;
-        }
-
-        public int getId() {
-            return this.id;
-        }
-
-        public static Parrot.Variant byId(int index) {
-            return BY_ID.apply(index);
-        }
-
-        @Override
-        public String getSerializedName() {
-            return this.name;
-        }
-    }
 }
