--- a/net/minecraft/world/entity/animal/allay/Allay.java
+++ b/net/minecraft/world/entity/animal/allay/Allay.java
@@ -2,7 +2,10 @@
 
 import com.google.common.collect.ImmutableList;
 import com.mojang.logging.LogUtils;
+import com.mojang.serialization.DataResult;
 import com.mojang.serialization.Dynamic;
+import java.util.Iterator;
+import java.util.Objects;
 import java.util.Optional;
 import java.util.UUID;
 import java.util.function.BiConsumer;
@@ -69,6 +72,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;
@@ -80,8 +84,8 @@
     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<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;
@@ -95,6 +99,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);
@@ -106,9 +111,15 @@
         this.dynamicJukeboxListener = new DynamicGameEventListener<>(new Allay.JukeboxListener(this.vibrationUser.getPositionSource(), GameEvent.JUKEBOX_PLAY.getNotificationRadius()));
     }
 
+    // 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
@@ -118,27 +129,28 @@
 
     @Override
     public Brain<Allay> getBrain() {
-        return super.getBrain();
+        return (Brain<Allay>) super.getBrain(); // CraftBukkit - decompile error
     }
 
     public static AttributeSupplier.Builder createAttributes() {
-        return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 20.0D).add(Attributes.FLYING_SPEED, (double)0.1F).add(Attributes.MOVEMENT_SPEED, (double)0.1F).add(Attributes.ATTACK_DAMAGE, 2.0D).add(Attributes.FOLLOW_RANGE, 48.0D);
+        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() {
         super.defineSynchedData();
-        this.entityData.define(DATA_DANCING, false);
-        this.entityData.define(DATA_CAN_DUPLICATE, true);
+        this.entityData.define(Allay.DATA_DANCING, false);
+        this.entityData.define(Allay.DATA_CAN_DUPLICATE, true);
     }
 
     @Override
@@ -147,7 +159,7 @@
             if (this.isInWater()) {
                 this.moveRelative(0.02F, movementInput);
                 this.move(MoverType.SELF, this.getDeltaMovement());
-                this.setDeltaMovement(this.getDeltaMovement().scale((double)0.8F));
+                this.setDeltaMovement(this.getDeltaMovement().scale(0.800000011920929D));
             } else if (this.isInLava()) {
                 this.moveRelative(0.02F, movementInput);
                 this.move(MoverType.SELF, this.getDeltaMovement());
@@ -155,7 +167,7 @@
             } else {
                 this.moveRelative(this.getSpeed(), movementInput);
                 this.move(MoverType.SELF, this.getDeltaMovement());
-                this.setDeltaMovement(this.getDeltaMovement().scale((double)0.91F));
+                this.setDeltaMovement(this.getDeltaMovement().scale(0.9100000262260437D));
             }
         }
 
@@ -169,10 +181,13 @@
 
     @Override
     public boolean hurt(DamageSource source, float amount) {
-        Entity optional = source.getEntity();
-        if (optional instanceof Player player) {
+        Entity entity = source.getEntity();
+
+        if (entity instanceof Player) {
+            Player entityhuman = (Player) entity;
             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;
             }
         }
@@ -181,12 +196,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() {
@@ -211,7 +224,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);
@@ -223,7 +236,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) {
@@ -289,32 +302,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);
@@ -341,13 +364,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) {
@@ -355,19 +379,22 @@
     }
 
     private boolean hasNonMatchingPotion(ItemStack stack, ItemStack stack2) {
-        CompoundTag compoundTag = stack.getTag();
-        boolean bl = compoundTag != null && compoundTag.contains("Potion");
-        if (!bl) {
+        CompoundTag nbttagcompound = stack.getTag();
+        boolean flag = nbttagcompound != null && nbttagcompound.contains("Potion");
+
+        if (!flag) {
             return false;
         } else {
-            CompoundTag compoundTag2 = stack2.getTag();
-            boolean bl2 = compoundTag2 != null && compoundTag2.contains("Potion");
-            if (!bl2) {
+            CompoundTag nbttagcompound1 = stack2.getTag();
+            boolean flag1 = nbttagcompound1 != null && nbttagcompound1.contains("Potion");
+
+            if (!flag1) {
                 return true;
             } else {
-                Tag tag = compoundTag.get("Potion");
-                Tag tag2 = compoundTag2.get("Potion");
-                return tag != null && tag2 != null && !tag.equals(tag2);
+                Tag nbtbase = nbttagcompound.get("Potion");
+                Tag nbtbase1 = nbttagcompound1.get("Potion");
+
+                return nbtbase != null && nbtbase1 != null && !nbtbase.equals(nbtbase1);
             }
         }
     }
@@ -390,26 +417,30 @@
 
     @Override
     public void updateDynamicGameEventListener(BiConsumer<DynamicGameEventListener<?>, ServerLevel> callback) {
-        Level var3 = this.level();
-        if (var3 instanceof ServerLevel serverLevel) {
-            callback.accept(this.dynamicVibrationListener, serverLevel);
-            callback.accept(this.dynamicJukeboxListener, serverLevel);
+        Level world = this.level();
+
+        if (world instanceof ServerLevel) {
+            ServerLevel worldserver = (ServerLevel) world;
+
+            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.getNotificationRadius()) || !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.JUKEBOX_PLAY.getNotificationRadius()) || !this.level().getBlockState(this.jukeboxPos).is(Blocks.JUKEBOX);
     }
 
     public float getHoldingItemAnimationProgress(float f) {
@@ -418,6 +449,7 @@
 
     public boolean isSpinning() {
         float f = this.dancingAnimationTicks % 55.0F;
+
         return f < 15.0F;
     }
 
@@ -434,9 +466,10 @@
     protected void dropEquipment() {
         super.dropEquipment();
         this.inventory.removeAllItems().forEach(this::spawnAtLocation);
-        ItemStack itemStack = this.getItemBySlot(EquipmentSlot.MAINHAND);
-        if (!itemStack.isEmpty() && !EnchantmentHelper.hasVanishingCurse(itemStack)) {
-            this.spawnAtLocation(itemStack);
+        ItemStack itemstack = this.getItemBySlot(EquipmentSlot.MAINHAND);
+
+        if (!itemstack.isEmpty() && !EnchantmentHelper.hasVanishingCurse(itemstack)) {
+            this.spawnAtLocation(itemstack);
             this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY);
         }
 
@@ -451,8 +484,12 @@
     public void addAdditionalSaveData(CompoundTag nbt) {
         super.addAdditionalSaveData(nbt);
         this.writeInventoryToTag(nbt);
-        VibrationSystem.Data.CODEC.encodeStart(NbtOps.INSTANCE, this.vibrationData).resultOrPartial(LOGGER::error).ifPresent((tag) -> {
-            nbt.put("listener", tag);
+        DataResult<net.minecraft.nbt.Tag> dataresult = VibrationSystem.Data.CODEC.encodeStart(NbtOps.INSTANCE, this.vibrationData); // CraftBukkit - decompile error
+        Logger logger = Allay.LOGGER;
+
+        Objects.requireNonNull(logger);
+        dataresult.resultOrPartial(logger::error).ifPresent((nbtbase) -> {
+            nbt.put("listener", nbtbase);
         });
         nbt.putLong("DuplicationCooldown", this.duplicationCooldown);
         nbt.putBoolean("CanDuplicate", this.canDuplicate());
@@ -463,13 +500,17 @@
         super.readAdditionalSaveData(nbt);
         this.readInventoryFromTag(nbt);
         if (nbt.contains("listener", 10)) {
-            VibrationSystem.Data.CODEC.parse(new Dynamic<>(NbtOps.INSTANCE, nbt.getCompound("listener"))).resultOrPartial(LOGGER::error).ifPresent((data) -> {
-                this.vibrationData = data;
+            DataResult<VibrationSystem.Data> dataresult = VibrationSystem.Data.CODEC.parse(new Dynamic(NbtOps.INSTANCE, nbt.getCompound("listener"))); // CraftBukkit - decompile error
+            Logger logger = Allay.LOGGER;
+
+            Objects.requireNonNull(logger);
+            dataresult.resultOrPartial(logger::error).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
@@ -483,34 +524,35 @@
         }
 
         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) {
@@ -522,7 +564,7 @@
 
     @Override
     public Vec3 getLeashOffset() {
-        return new Vec3(0.0D, (double)this.getEyeHeight() * 0.6D, (double)this.getBbWidth() * 0.1D);
+        return new Vec3(0.0D, (double) this.getEyeHeight() * 0.6D, (double) this.getBbWidth() * 0.1D);
     }
 
     @Override
@@ -533,7 +575,7 @@
     @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 {
@@ -543,10 +585,11 @@
     }
 
     private void spawnHeartParticle() {
-        double d = this.random.nextGaussian() * 0.02D;
-        double e = this.random.nextGaussian() * 0.02D;
-        double f = this.random.nextGaussian() * 0.02D;
-        this.level().addParticle(ParticleTypes.HEART, this.getRandomX(1.0D), this.getRandomY() + 0.5D, this.getRandomZ(1.0D), 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
@@ -559,43 +602,13 @@
         return this.vibrationUser;
     }
 
-    class JukeboxListener implements GameEventListener {
-        private final PositionSource listenerSource;
-        private final int listenerRadius;
-
-        public JukeboxListener(PositionSource positionSource, 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, GameEvent event, GameEvent.Context emitter, Vec3 emitterPos) {
-            if (event == GameEvent.JUKEBOX_PLAY) {
-                Allay.this.setJukeboxPlaying(BlockPos.containing(emitterPos), true);
-                return true;
-            } else if (event == 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;
@@ -612,11 +625,13 @@
                 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);
                 }
             }
         }
@@ -634,4 +649,38 @@
             return GameEventTags.ALLAY_CAN_LISTEN;
         }
     }
+
+    private class JukeboxListener implements GameEventListener {
+
+        private final PositionSource listenerSource;
+        private final int listenerRadius;
+
+        public JukeboxListener(PositionSource positionsource, 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, GameEvent event, GameEvent.Context emitter, Vec3 emitterPos) {
+            if (event == GameEvent.JUKEBOX_PLAY) {
+                Allay.this.setJukeboxPlaying(BlockPos.containing(emitterPos), true);
+                return true;
+            } else if (event == GameEvent.JUKEBOX_STOP_PLAY) {
+                Allay.this.setJukeboxPlaying(BlockPos.containing(emitterPos), false);
+                return true;
+            } else {
+                return false;
+            }
+        }
+    }
 }
