--- a/net/minecraft/world/entity/animal/allay/Allay.java
+++ b/net/minecraft/world/entity/animal/allay/Allay.java
@@ -3,6 +3,7 @@
 import com.google.common.collect.ImmutableList;
 import com.mojang.logging.LogUtils;
 import com.mojang.serialization.Dynamic;
+import java.util.Iterator;
 import java.util.Objects;
 import java.util.Optional;
 import java.util.UUID;
@@ -73,6 +74,7 @@
 import org.slf4j.Logger;
 
 public class Allay extends PathfinderMob implements InventoryCarrier, VibrationSystem {
+
     private static final Logger LOGGER = LogUtils.getLogger();
     private static final Vec3i ITEM_PICKUP_REACH = new Vec3i(1, 1, 1);
     private static final int LIFTING_ITEM_ANIMATION_DURATION = 5;
@@ -83,26 +85,9 @@
     private static final int NUM_OF_DUPLICATION_HEARTS = 3;
     private static final EntityDataAccessor<Boolean> DATA_DANCING = SynchedEntityData.defineId(Allay.class, EntityDataSerializers.BOOLEAN);
     private static final EntityDataAccessor<Boolean> DATA_CAN_DUPLICATE = SynchedEntityData.defineId(Allay.class, EntityDataSerializers.BOOLEAN);
-    protected static final ImmutableList<SensorType<? extends Sensor<? super Allay>>> SENSOR_TYPES = ImmutableList.of(
-        SensorType.NEAREST_LIVING_ENTITIES, SensorType.NEAREST_PLAYERS, SensorType.HURT_BY, SensorType.NEAREST_ITEMS
-    );
-    protected static final ImmutableList<MemoryModuleType<?>> MEMORY_TYPES = ImmutableList.of(
-        MemoryModuleType.PATH,
-        MemoryModuleType.LOOK_TARGET,
-        MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES,
-        MemoryModuleType.WALK_TARGET,
-        MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE,
-        MemoryModuleType.HURT_BY,
-        MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM,
-        MemoryModuleType.LIKED_PLAYER,
-        MemoryModuleType.LIKED_NOTEBLOCK_POSITION,
-        MemoryModuleType.LIKED_NOTEBLOCK_COOLDOWN_TICKS,
-        MemoryModuleType.ITEM_PICKUP_COOLDOWN_TICKS,
-        MemoryModuleType.IS_PANICKING
-    );
-    public static final ImmutableList<Float> THROW_SOUND_PITCHES = ImmutableList.of(
-        0.5625F, 0.625F, 0.75F, 0.9375F, 1.0F, 1.0F, 1.125F, 1.25F, 1.5F, 1.875F, 2.0F, 2.25F, 2.5F, 3.0F, 3.75F, 4.0F
-    );
+    protected static final ImmutableList<SensorType<? extends Sensor<? super Allay>>> SENSOR_TYPES = ImmutableList.of(SensorType.NEAREST_LIVING_ENTITIES, SensorType.NEAREST_PLAYERS, SensorType.HURT_BY, SensorType.NEAREST_ITEMS);
+    protected static final ImmutableList<MemoryModuleType<?>> MEMORY_TYPES = ImmutableList.of(MemoryModuleType.PATH, MemoryModuleType.LOOK_TARGET, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.WALK_TARGET, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.HURT_BY, MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM, MemoryModuleType.LIKED_PLAYER, MemoryModuleType.LIKED_NOTEBLOCK_POSITION, MemoryModuleType.LIKED_NOTEBLOCK_COOLDOWN_TICKS, MemoryModuleType.ITEM_PICKUP_COOLDOWN_TICKS, MemoryModuleType.IS_PANICKING, new MemoryModuleType[0]);
+    public static final ImmutableList<Float> THROW_SOUND_PITCHES = ImmutableList.of(0.5625F, 0.625F, 0.75F, 0.9375F, 1.0F, 1.0F, 1.125F, 1.25F, 1.5F, 1.875F, 2.0F, 2.25F, new Float[]{2.5F, 3.0F, 3.75F, 4.0F});
     private final DynamicGameEventListener<VibrationSystem.Listener> dynamicVibrationListener;
     private VibrationSystem.Data vibrationData;
     private final VibrationSystem.User vibrationUser;
@@ -116,6 +101,7 @@
     private float dancingAnimationTicks;
     private float spinningAnimationTicks;
     private float spinningAnimationTicks0;
+    public boolean forceDancing = false; // CraftBukkit
 
     public Allay(EntityType<? extends Allay> type, Level world) {
         super(type, world);
@@ -124,14 +110,18 @@
         this.vibrationUser = new Allay.VibrationUser();
         this.vibrationData = new VibrationSystem.Data();
         this.dynamicVibrationListener = new DynamicGameEventListener<>(new VibrationSystem.Listener(this));
-        this.dynamicJukeboxListener = new DynamicGameEventListener<>(
-            new Allay.JukeboxListener(this.vibrationUser.getPositionSource(), GameEvent.JUKEBOX_PLAY.value().notificationRadius())
-        );
+        this.dynamicJukeboxListener = new DynamicGameEventListener<>(new Allay.JukeboxListener(this.vibrationUser.getPositionSource(), ((GameEvent) GameEvent.JUKEBOX_PLAY.value()).notificationRadius()));
+    }
+
+    // CraftBukkit start
+    public void setCanDuplicate(boolean canDuplicate) {
+        this.entityData.set(Allay.DATA_CAN_DUPLICATE, canDuplicate);
     }
+    // CraftBukkit end
 
     @Override
     protected Brain.Provider<Allay> brainProvider() {
-        return Brain.provider(MEMORY_TYPES, SENSOR_TYPES);
+        return Brain.provider(Allay.MEMORY_TYPES, Allay.SENSOR_TYPES);
     }
 
     @Override
@@ -141,32 +131,28 @@
 
     @Override
     public Brain<Allay> getBrain() {
-        return (Brain<Allay>)super.getBrain();
+        return (Brain<Allay>) super.getBrain(); // CraftBukkit - decompile error
     }
 
     public static AttributeSupplier.Builder createAttributes() {
-        return Mob.createMobAttributes()
-            .add(Attributes.MAX_HEALTH, 20.0)
-            .add(Attributes.FLYING_SPEED, 0.1F)
-            .add(Attributes.MOVEMENT_SPEED, 0.1F)
-            .add(Attributes.ATTACK_DAMAGE, 2.0)
-            .add(Attributes.FOLLOW_RANGE, 48.0);
+        return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 20.0D).add(Attributes.FLYING_SPEED, 0.10000000149011612D).add(Attributes.MOVEMENT_SPEED, 0.10000000149011612D).add(Attributes.ATTACK_DAMAGE, 2.0D).add(Attributes.FOLLOW_RANGE, 48.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
     protected void defineSynchedData(SynchedEntityData.Builder builder) {
         super.defineSynchedData(builder);
-        builder.define(DATA_DANCING, false);
-        builder.define(DATA_CAN_DUPLICATE, true);
+        builder.define(Allay.DATA_DANCING, false);
+        builder.define(Allay.DATA_CAN_DUPLICATE, true);
     }
 
     @Override
@@ -175,15 +161,15 @@
             if (this.isInWater()) {
                 this.moveRelative(0.02F, movementInput);
                 this.move(MoverType.SELF, this.getDeltaMovement());
-                this.setDeltaMovement(this.getDeltaMovement().scale(0.8F));
+                this.setDeltaMovement(this.getDeltaMovement().scale(0.800000011920929D));
             } else if (this.isInLava()) {
                 this.moveRelative(0.02F, movementInput);
                 this.move(MoverType.SELF, this.getDeltaMovement());
-                this.setDeltaMovement(this.getDeltaMovement().scale(0.5));
+                this.setDeltaMovement(this.getDeltaMovement().scale(0.5D));
             } else {
                 this.moveRelative(this.getSpeed(), movementInput);
                 this.move(MoverType.SELF, this.getDeltaMovement());
-                this.setDeltaMovement(this.getDeltaMovement().scale(0.91F));
+                this.setDeltaMovement(this.getDeltaMovement().scale(0.9100000262260437D));
             }
         }
 
@@ -192,9 +178,12 @@
 
     @Override
     public boolean hurt(DamageSource source, float amount) {
-        if (source.getEntity() instanceof Player player) {
+        Entity entity = source.getEntity();
+
+        if (entity instanceof Player entityhuman) {
             Optional<UUID> optional = this.getBrain().getMemory(MemoryModuleType.LIKED_PLAYER);
-            if (optional.isPresent() && player.getUUID().equals(optional.get())) {
+
+            if (optional.isPresent() && entityhuman.getUUID().equals(optional.get())) {
                 return false;
             }
         }
@@ -203,12 +192,10 @@
     }
 
     @Override
-    protected void playStepSound(BlockPos pos, BlockState state) {
-    }
+    protected void playStepSound(BlockPos pos, BlockState state) {}
 
     @Override
-    protected void checkFallDamage(double heightDifference, boolean onGround, BlockState state, BlockPos landedPosition) {
-    }
+    protected void checkFallDamage(double heightDifference, boolean onGround, BlockState state, BlockPos landedPosition) {}
 
     @Override
     protected SoundEvent getAmbientSound() {
@@ -233,7 +220,7 @@
     @Override
     protected void customServerAiStep() {
         this.level().getProfiler().push("allayBrain");
-        this.getBrain().tick((ServerLevel)this.level(), this);
+        this.getBrain().tick((ServerLevel) this.level(), this);
         this.level().getProfiler().pop();
         this.level().getProfiler().push("allayActivityUpdate");
         AllayAi.updateActivity(this);
@@ -245,7 +232,7 @@
     public void aiStep() {
         super.aiStep();
         if (!this.level().isClientSide && this.isAlive() && this.tickCount % 10 == 0) {
-            this.heal(1.0F);
+            this.heal(1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.REGEN); // CraftBukkit
         }
 
         if (this.isDancing() && this.shouldStopDancing() && this.tickCount % 20 == 0) {
@@ -268,12 +255,12 @@
             }
 
             if (this.isDancing()) {
-                this.dancingAnimationTicks++;
+                ++this.dancingAnimationTicks;
                 this.spinningAnimationTicks0 = this.spinningAnimationTicks;
                 if (this.isSpinning()) {
-                    this.spinningAnimationTicks++;
+                    ++this.spinningAnimationTicks;
                 } else {
-                    this.spinningAnimationTicks--;
+                    --this.spinningAnimationTicks;
                 }
 
                 this.spinningAnimationTicks = Mth.clamp(this.spinningAnimationTicks, 0.0F, 15.0F);
@@ -288,6 +275,7 @@
                 this.setDancing(false);
             }
         }
+
     }
 
     @Override
@@ -310,32 +298,42 @@
 
     @Override
     protected InteractionResult mobInteract(Player player, InteractionHand hand) {
-        ItemStack itemStack = player.getItemInHand(hand);
-        ItemStack itemStack2 = this.getItemInHand(InteractionHand.MAIN_HAND);
-        if (this.isDancing() && this.isDuplicationItem(itemStack) && this.canDuplicate()) {
-            this.duplicateAllay();
-            this.level().broadcastEntityEvent(this, (byte)18);
-            this.level().playSound(player, this, SoundEvents.AMETHYST_BLOCK_CHIME, SoundSource.NEUTRAL, 2.0F, 1.0F);
-            this.removeInteractionItem(player, itemStack);
+        ItemStack itemstack = player.getItemInHand(hand);
+        ItemStack itemstack1 = this.getItemInHand(InteractionHand.MAIN_HAND);
+
+        if (this.isDancing() && this.isDuplicationItem(itemstack) && this.canDuplicate()) {
+            // CraftBukkit start - handle cancel duplication
+            Allay allay = this.duplicateAllay();
+            if (allay == null) {
+                return InteractionResult.SUCCESS;
+            }
+            // CraftBukkit end
+            this.level().broadcastEntityEvent(this, (byte) 18);
+            this.level().playSound(player, (Entity) this, SoundEvents.AMETHYST_BLOCK_CHIME, SoundSource.NEUTRAL, 2.0F, 1.0F);
+            this.removeInteractionItem(player, itemstack);
             return InteractionResult.SUCCESS;
-        } else if (itemStack2.isEmpty() && !itemStack.isEmpty()) {
-            ItemStack itemStack3 = itemStack.copyWithCount(1);
-            this.setItemInHand(InteractionHand.MAIN_HAND, itemStack3);
-            this.removeInteractionItem(player, itemStack);
-            this.level().playSound(player, this, SoundEvents.ALLAY_ITEM_GIVEN, SoundSource.NEUTRAL, 2.0F, 1.0F);
-            this.getBrain().setMemory(MemoryModuleType.LIKED_PLAYER, player.getUUID());
+        } else if (itemstack1.isEmpty() && !itemstack.isEmpty()) {
+            ItemStack itemstack2 = itemstack.copyWithCount(1);
+
+            this.setItemInHand(InteractionHand.MAIN_HAND, itemstack2);
+            this.removeInteractionItem(player, itemstack);
+            this.level().playSound(player, (Entity) this, SoundEvents.ALLAY_ITEM_GIVEN, SoundSource.NEUTRAL, 2.0F, 1.0F);
+            this.getBrain().setMemory(MemoryModuleType.LIKED_PLAYER, player.getUUID()); // CraftBukkit - decompile error
             return InteractionResult.SUCCESS;
-        } else if (!itemStack2.isEmpty() && hand == InteractionHand.MAIN_HAND && itemStack.isEmpty()) {
+        } else if (!itemstack1.isEmpty() && hand == InteractionHand.MAIN_HAND && itemstack.isEmpty()) {
             this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY);
-            this.level().playSound(player, this, SoundEvents.ALLAY_ITEM_TAKEN, SoundSource.NEUTRAL, 2.0F, 1.0F);
+            this.level().playSound(player, (Entity) this, SoundEvents.ALLAY_ITEM_TAKEN, SoundSource.NEUTRAL, 2.0F, 1.0F);
             this.swing(InteractionHand.MAIN_HAND);
+            Iterator iterator = this.getInventory().removeAllItems().iterator();
 
-            for (ItemStack itemStack4 : this.getInventory().removeAllItems()) {
-                BehaviorUtils.throwItem(this, itemStack4, this.position());
+            while (iterator.hasNext()) {
+                ItemStack itemstack3 = (ItemStack) iterator.next();
+
+                BehaviorUtils.throwItem(this, itemstack3, this.position());
             }
 
             this.getBrain().eraseMemory(MemoryModuleType.LIKED_PLAYER);
-            player.addItem(itemStack2);
+            player.addItem(itemstack1);
             return InteractionResult.SUCCESS;
         } else {
             return super.mobInteract(player, hand);
@@ -352,6 +350,7 @@
             this.jukeboxPos = null;
             this.setDancing(false);
         }
+
     }
 
     @Override
@@ -361,16 +360,14 @@
 
     @Override
     protected Vec3i getPickupReach() {
-        return ITEM_PICKUP_REACH;
+        return Allay.ITEM_PICKUP_REACH;
     }
 
     @Override
     public boolean wantsToPickUp(ItemStack stack) {
-        ItemStack itemStack = this.getItemInHand(InteractionHand.MAIN_HAND);
-        return !itemStack.isEmpty()
-            && this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)
-            && this.inventory.canAddItem(stack)
-            && this.allayConsidersItemEqual(itemStack, stack);
+        ItemStack itemstack1 = this.getItemInHand(InteractionHand.MAIN_HAND);
+
+        return !itemstack1.isEmpty() && this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && this.inventory.canAddItem(stack) && this.allayConsidersItemEqual(itemstack1, stack);
     }
 
     private boolean allayConsidersItemEqual(ItemStack stack, ItemStack stack2) {
@@ -378,9 +375,10 @@
     }
 
     private boolean hasNonMatchingPotion(ItemStack stack, ItemStack stack2) {
-        PotionContents potionContents = stack.get(DataComponents.POTION_CONTENTS);
-        PotionContents potionContents2 = stack2.get(DataComponents.POTION_CONTENTS);
-        return !Objects.equals(potionContents, potionContents2);
+        PotionContents potioncontents = (PotionContents) stack.get(DataComponents.POTION_CONTENTS);
+        PotionContents potioncontents1 = (PotionContents) stack2.get(DataComponents.POTION_CONTENTS);
+
+        return !Objects.equals(potioncontents, potioncontents1);
     }
 
     @Override
@@ -401,26 +399,28 @@
 
     @Override
     public void updateDynamicGameEventListener(BiConsumer<DynamicGameEventListener<?>, ServerLevel> callback) {
-        if (this.level() instanceof ServerLevel serverLevel) {
-            callback.accept(this.dynamicVibrationListener, serverLevel);
-            callback.accept(this.dynamicJukeboxListener, serverLevel);
+        Level world = this.level();
+
+        if (world instanceof ServerLevel worldserver) {
+            callback.accept(this.dynamicVibrationListener, worldserver);
+            callback.accept(this.dynamicJukeboxListener, worldserver);
         }
+
     }
 
     public boolean isDancing() {
-        return this.entityData.get(DATA_DANCING);
+        return (Boolean) this.entityData.get(Allay.DATA_DANCING);
     }
 
     public void setDancing(boolean dancing) {
         if (!this.level().isClientSide && this.isEffectiveAi() && (!dancing || !this.isPanicking())) {
-            this.entityData.set(DATA_DANCING, dancing);
+            this.entityData.set(Allay.DATA_DANCING, dancing);
         }
     }
 
     private boolean shouldStopDancing() {
-        return this.jukeboxPos == null
-            || !this.jukeboxPos.closerToCenterThan(this.position(), (double)GameEvent.JUKEBOX_PLAY.value().notificationRadius())
-            || !this.level().getBlockState(this.jukeboxPos).is(Blocks.JUKEBOX);
+        if (this.forceDancing) {return false;} // CraftBukkit
+        return this.jukeboxPos == null || !this.jukeboxPos.closerToCenterThan(this.position(), (double) ((GameEvent) GameEvent.JUKEBOX_PLAY.value()).notificationRadius()) || !this.level().getBlockState(this.jukeboxPos).is(Blocks.JUKEBOX);
     }
 
     public float getHoldingItemAnimationProgress(float f) {
@@ -429,6 +429,7 @@
 
     public boolean isSpinning() {
         float f = this.dancingAnimationTicks % 55.0F;
+
         return f < 15.0F;
     }
 
@@ -445,11 +446,13 @@
     protected void dropEquipment() {
         super.dropEquipment();
         this.inventory.removeAllItems().forEach(this::spawnAtLocation);
-        ItemStack itemStack = this.getItemBySlot(EquipmentSlot.MAINHAND);
-        if (!itemStack.isEmpty() && !EnchantmentHelper.has(itemStack, EnchantmentEffectComponents.PREVENT_EQUIPMENT_DROP)) {
-            this.spawnAtLocation(itemStack);
+        ItemStack itemstack = this.getItemBySlot(EquipmentSlot.MAINHAND);
+
+        if (!itemstack.isEmpty() && !EnchantmentHelper.has(itemstack, EnchantmentEffectComponents.PREVENT_EQUIPMENT_DROP)) {
+            this.spawnAtLocation(itemstack);
             this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY);
         }
+
     }
 
     @Override
@@ -461,11 +464,13 @@
     public void addAdditionalSaveData(CompoundTag nbt) {
         super.addAdditionalSaveData(nbt);
         this.writeInventoryToTag(nbt, this.registryAccess());
-        RegistryOps<Tag> registryOps = this.registryAccess().createSerializationContext(NbtOps.INSTANCE);
-        VibrationSystem.Data.CODEC
-            .encodeStart(registryOps, this.vibrationData)
-            .resultOrPartial(string -> LOGGER.error("Failed to encode vibration listener for Allay: '{}'", string))
-            .ifPresent(tag -> nbt.put("listener", tag));
+        RegistryOps<Tag> registryops = this.registryAccess().createSerializationContext(NbtOps.INSTANCE);
+
+        VibrationSystem.Data.CODEC.encodeStart(registryops, this.vibrationData).resultOrPartial((s) -> {
+            Allay.LOGGER.error("Failed to encode vibration listener for Allay: '{}'", s);
+        }).ifPresent((nbtbase) -> {
+            nbt.put("listener", nbtbase);
+        });
         nbt.putLong("DuplicationCooldown", this.duplicationCooldown);
         nbt.putBoolean("CanDuplicate", this.canDuplicate());
     }
@@ -474,16 +479,18 @@
     public void readAdditionalSaveData(CompoundTag nbt) {
         super.readAdditionalSaveData(nbt);
         this.readInventoryFromTag(nbt, this.registryAccess());
-        RegistryOps<Tag> registryOps = this.registryAccess().createSerializationContext(NbtOps.INSTANCE);
+        RegistryOps<Tag> registryops = this.registryAccess().createSerializationContext(NbtOps.INSTANCE);
+
         if (nbt.contains("listener", 10)) {
-            VibrationSystem.Data.CODEC
-                .parse(registryOps, nbt.getCompound("listener"))
-                .resultOrPartial(string -> LOGGER.error("Failed to parse vibration listener for Allay: '{}'", string))
-                .ifPresent(data -> this.vibrationData = data);
+            VibrationSystem.Data.CODEC.parse(registryops, nbt.getCompound("listener")).resultOrPartial((s) -> {
+                Allay.LOGGER.error("Failed to parse vibration listener for Allay: '{}'", s);
+            }).ifPresent((vibrationsystem_a) -> {
+                this.vibrationData = vibrationsystem_a;
+            });
         }
 
-        this.duplicationCooldown = (long)nbt.getInt("DuplicationCooldown");
-        this.entityData.set(DATA_CAN_DUPLICATE, nbt.getBoolean("CanDuplicate"));
+        this.duplicationCooldown = nbt.getLong("DuplicationCooldown"); // Paper - Load as long
+        this.entityData.set(Allay.DATA_CAN_DUPLICATE, nbt.getBoolean("CanDuplicate"));
     }
 
     @Override
@@ -493,36 +500,39 @@
 
     private void updateDuplicationCooldown() {
         if (this.duplicationCooldown > 0L) {
-            this.duplicationCooldown--;
+            --this.duplicationCooldown;
         }
 
         if (!this.level().isClientSide() && this.duplicationCooldown == 0L && !this.canDuplicate()) {
-            this.entityData.set(DATA_CAN_DUPLICATE, true);
+            this.entityData.set(Allay.DATA_CAN_DUPLICATE, true);
         }
+
     }
 
     private boolean isDuplicationItem(ItemStack stack) {
-        return DUPLICATION_ITEM.test(stack);
+        return Allay.DUPLICATION_ITEM.test(stack);
     }
 
-    public void duplicateAllay() {
-        Allay allay = EntityType.ALLAY.create(this.level());
+    public Allay duplicateAllay() { // CraftBukkit - return allay
+        Allay allay = (Allay) EntityType.ALLAY.create(this.level());
+
         if (allay != null) {
             allay.moveTo(this.position());
             allay.setPersistenceRequired();
             allay.resetDuplicationCooldown();
             this.resetDuplicationCooldown();
-            this.level().addFreshEntity(allay);
+            this.level().addFreshEntity(allay, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DUPLICATION); // CraftBukkit - reason for duplicated allay
         }
+        return allay; // CraftBukkit
     }
 
     public void resetDuplicationCooldown() {
         this.duplicationCooldown = 6000L;
-        this.entityData.set(DATA_CAN_DUPLICATE, false);
+        this.entityData.set(Allay.DATA_CAN_DUPLICATE, false);
     }
 
     public boolean canDuplicate() {
-        return this.entityData.get(DATA_CAN_DUPLICATE);
+        return (Boolean) this.entityData.get(Allay.DATA_CAN_DUPLICATE);
     }
 
     private void removeInteractionItem(Player player, ItemStack stack) {
@@ -531,25 +541,27 @@
 
     @Override
     public Vec3 getLeashOffset() {
-        return new Vec3(0.0, (double)this.getEyeHeight() * 0.6, (double)this.getBbWidth() * 0.1);
+        return new Vec3(0.0D, (double) this.getEyeHeight() * 0.6D, (double) this.getBbWidth() * 0.1D);
     }
 
     @Override
     public void handleEntityEvent(byte status) {
         if (status == 18) {
-            for (int i = 0; i < 3; i++) {
+            for (int i = 0; i < 3; ++i) {
                 this.spawnHeartParticle();
             }
         } else {
             super.handleEntityEvent(status);
         }
+
     }
 
     private void spawnHeartParticle() {
-        double d = this.random.nextGaussian() * 0.02;
-        double e = this.random.nextGaussian() * 0.02;
-        double f = this.random.nextGaussian() * 0.02;
-        this.level().addParticle(ParticleTypes.HEART, this.getRandomX(1.0), this.getRandomY() + 0.5, this.getRandomZ(1.0), d, e, f);
+        double d0 = this.random.nextGaussian() * 0.02D;
+        double d1 = this.random.nextGaussian() * 0.02D;
+        double d2 = this.random.nextGaussian() * 0.02D;
+
+        this.level().addParticle(ParticleTypes.HEART, this.getRandomX(1.0D), this.getRandomY() + 0.5D, this.getRandomZ(1.0D), d0, d1, d2);
     }
 
     @Override
@@ -562,43 +574,13 @@
         return this.vibrationUser;
     }
 
-    class JukeboxListener implements GameEventListener {
-        private final PositionSource listenerSource;
-        private final int listenerRadius;
-
-        public JukeboxListener(final PositionSource positionSource, final int range) {
-            this.listenerSource = positionSource;
-            this.listenerRadius = range;
-        }
-
-        @Override
-        public PositionSource getListenerSource() {
-            return this.listenerSource;
-        }
-
-        @Override
-        public int getListenerRadius() {
-            return this.listenerRadius;
-        }
-
-        @Override
-        public boolean handleGameEvent(ServerLevel world, Holder<GameEvent> event, GameEvent.Context emitter, Vec3 emitterPos) {
-            if (event.is(GameEvent.JUKEBOX_PLAY)) {
-                Allay.this.setJukeboxPlaying(BlockPos.containing(emitterPos), true);
-                return true;
-            } else if (event.is(GameEvent.JUKEBOX_STOP_PLAY)) {
-                Allay.this.setJukeboxPlaying(BlockPos.containing(emitterPos), false);
-                return true;
-            } else {
-                return false;
-            }
-        }
-    }
+    private class VibrationUser implements VibrationSystem.User {
 
-    class VibrationUser implements VibrationSystem.User {
         private static final int VIBRATION_EVENT_LISTENER_RANGE = 16;
         private final PositionSource positionSource = new EntityPositionSource(Allay.this, Allay.this.getEyeHeight());
 
+        VibrationUser() {}
+
         @Override
         public int getListenerRadius() {
             return 16;
@@ -615,22 +597,23 @@
                 return false;
             } else {
                 Optional<GlobalPos> optional = Allay.this.getBrain().getMemory(MemoryModuleType.LIKED_NOTEBLOCK_POSITION);
+
                 if (optional.isEmpty()) {
                     return true;
                 } else {
-                    GlobalPos globalPos = optional.get();
-                    return globalPos.dimension().equals(world.dimension()) && globalPos.pos().equals(pos);
+                    GlobalPos globalpos = (GlobalPos) optional.get();
+
+                    return globalpos.dimension().equals(world.dimension()) && globalpos.pos().equals(pos);
                 }
             }
         }
 
         @Override
-        public void onReceiveVibration(
-            ServerLevel world, BlockPos pos, Holder<GameEvent> event, @Nullable Entity sourceEntity, @Nullable Entity entity, float distance
-        ) {
-            if (event.is(GameEvent.NOTE_BLOCK_PLAY)) {
+        public void onReceiveVibration(ServerLevel world, BlockPos pos, Holder<GameEvent> event, @Nullable Entity sourceEntity, @Nullable Entity entity, float distance) {
+            if (event.is((Holder) GameEvent.NOTE_BLOCK_PLAY)) {
                 AllayAi.hearNoteblock(Allay.this, new BlockPos(pos));
             }
+
         }
 
         @Override
@@ -638,4 +621,38 @@
             return GameEventTags.ALLAY_CAN_LISTEN;
         }
     }
+
+    private class JukeboxListener implements GameEventListener {
+
+        private final PositionSource listenerSource;
+        private final int listenerRadius;
+
+        public JukeboxListener(final PositionSource positionsource, final int i) {
+            this.listenerSource = positionsource;
+            this.listenerRadius = i;
+        }
+
+        @Override
+        public PositionSource getListenerSource() {
+            return this.listenerSource;
+        }
+
+        @Override
+        public int getListenerRadius() {
+            return this.listenerRadius;
+        }
+
+        @Override
+        public boolean handleGameEvent(ServerLevel world, Holder<GameEvent> event, GameEvent.Context emitter, Vec3 emitterPos) {
+            if (event.is((Holder) GameEvent.JUKEBOX_PLAY)) {
+                Allay.this.setJukeboxPlaying(BlockPos.containing(emitterPos), true);
+                return true;
+            } else if (event.is((Holder) GameEvent.JUKEBOX_STOP_PLAY)) {
+                Allay.this.setJukeboxPlaying(BlockPos.containing(emitterPos), false);
+                return true;
+            } else {
+                return false;
+            }
+        }
+    }
 }
