--- a/net/minecraft/world/level/block/BeehiveBlock.java
+++ b/net/minecraft/world/level/block/BeehiveBlock.java
@@ -1,12 +1,14 @@
 package net.minecraft.world.level.block;
 
 import com.mojang.serialization.MapCodec;
+import java.util.Iterator;
 import java.util.List;
 import javax.annotation.Nullable;
 import net.minecraft.Util;
 import net.minecraft.advancements.CriteriaTriggers;
 import net.minecraft.core.BlockPos;
 import net.minecraft.core.Direction;
+import net.minecraft.core.Holder;
 import net.minecraft.core.component.DataComponents;
 import net.minecraft.core.particles.ParticleTypes;
 import net.minecraft.server.level.ServerPlayer;
@@ -56,6 +58,7 @@
 import net.minecraft.world.phys.shapes.VoxelShape;
 
 public class BeehiveBlock extends BaseEntityBlock {
+
     public static final MapCodec<BeehiveBlock> CODEC = simpleCodec(BeehiveBlock::new);
     public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING;
     public static final IntegerProperty HONEY_LEVEL = BlockStateProperties.LEVEL_HONEY;
@@ -64,12 +67,12 @@
 
     @Override
     public MapCodec<BeehiveBlock> codec() {
-        return CODEC;
+        return BeehiveBlock.CODEC;
     }
 
     public BeehiveBlock(BlockBehaviour.Properties settings) {
         super(settings);
-        this.registerDefaultState(this.stateDefinition.any().setValue(HONEY_LEVEL, Integer.valueOf(0)).setValue(FACING, Direction.NORTH));
+        this.registerDefaultState((BlockState) ((BlockState) ((BlockState) this.stateDefinition.any()).setValue(BeehiveBlock.HONEY_LEVEL, 0)).setValue(BeehiveBlock.FACING, Direction.NORTH));
     }
 
     @Override
@@ -79,59 +82,79 @@
 
     @Override
     protected int getAnalogOutputSignal(BlockState state, Level world, BlockPos pos) {
-        return state.getValue(HONEY_LEVEL);
+        return (Integer) state.getValue(BeehiveBlock.HONEY_LEVEL);
     }
 
     @Override
-    public void playerDestroy(Level world, Player player, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity, ItemStack tool) {
-        super.playerDestroy(world, player, pos, state, blockEntity, tool);
-        if (!world.isClientSide && blockEntity instanceof BeehiveBlockEntity beehiveBlockEntity) {
+    public void playerDestroy(Level world, Player player, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity, ItemStack tool, boolean includeDrops, boolean dropExp) { // Paper - fix drops not preventing stats/food exhaustion
+        super.playerDestroy(world, player, pos, state, blockEntity, tool, includeDrops, dropExp); // Paper - fix drops not preventing stats/food exhaustion
+        if (!world.isClientSide && blockEntity instanceof BeehiveBlockEntity tileentitybeehive) {
             if (EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) == 0) {
-                beehiveBlockEntity.emptyAllLivingFromHive(player, state, BeehiveBlockEntity.BeeReleaseStatus.EMERGENCY);
+                tileentitybeehive.emptyAllLivingFromHive(player, state, BeehiveBlockEntity.BeeReleaseStatus.EMERGENCY);
                 world.updateNeighbourForOutputSignal(pos, this);
                 this.angerNearbyBees(world, pos);
             }
 
-            CriteriaTriggers.BEE_NEST_DESTROYED.trigger((ServerPlayer)player, state, tool, beehiveBlockEntity.getOccupantCount());
+            // CriteriaTriggers.BEE_NEST_DESTROYED.trigger((ServerPlayer) player, state, tool, tileentitybeehive.getOccupantCount()); // Paper - Trigger bee_nest_destroyed trigger in the correct place; moved until after items are dropped
         }
+
     }
 
     private void angerNearbyBees(Level world, BlockPos pos) {
-        AABB aABB = new AABB(pos).inflate(8.0, 6.0, 8.0);
-        List<Bee> list = world.getEntitiesOfClass(Bee.class, aABB);
+        AABB axisalignedbb = (new AABB(pos)).inflate(8.0D, 6.0D, 8.0D);
+        List<Bee> list = world.getEntitiesOfClass(Bee.class, axisalignedbb);
+
         if (!list.isEmpty()) {
-            List<Player> list2 = world.getEntitiesOfClass(Player.class, aABB);
-            if (list2.isEmpty()) {
+            List<Player> list1 = world.getEntitiesOfClass(Player.class, axisalignedbb);
+
+            if (list1.isEmpty()) {
                 return;
             }
 
-            for (Bee bee : list) {
-                if (bee.getTarget() == null) {
-                    Player player = Util.getRandom(list2, world.random);
-                    bee.setTarget(player);
+            Iterator iterator = list.iterator();
+
+            while (iterator.hasNext()) {
+                Bee entitybee = (Bee) iterator.next();
+
+                if (entitybee.getTarget() == null) {
+                    Player entityhuman = (Player) Util.getRandom(list1, world.random);
+
+                    entitybee.setTarget(entityhuman, org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER, true); // CraftBukkit
                 }
             }
         }
+
     }
 
     public static void dropHoneycomb(Level world, BlockPos pos) {
-        popResource(world, pos, new ItemStack(Items.HONEYCOMB, 3));
+        popResource(world, pos, new ItemStack(Items.HONEYCOMB, 3)); // Paper - Add PlayerShearBlockEvent; conflict on change, item needs to be set below
     }
 
     @Override
-    protected ItemInteractionResult useItemOn(
-        ItemStack stack, BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit
-    ) {
-        int i = state.getValue(HONEY_LEVEL);
-        boolean bl = false;
+    protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
+        int i = (Integer) state.getValue(BeehiveBlock.HONEY_LEVEL);
+        boolean flag = false;
+
         if (i >= 5) {
             Item item = stack.getItem();
+
             if (stack.is(Items.SHEARS)) {
+                // Paper start - Add PlayerShearBlockEvent
+                io.papermc.paper.event.block.PlayerShearBlockEvent event = new io.papermc.paper.event.block.PlayerShearBlockEvent((org.bukkit.entity.Player) player.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(stack), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand), new java.util.ArrayList<>());
+                event.getDrops().add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(new ItemStack(Items.HONEYCOMB, 3)));
+                if (!event.callEvent()) {
+                    return ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION;
+                }
+                // Paper end
                 world.playSound(player, player.getX(), player.getY(), player.getZ(), SoundEvents.BEEHIVE_SHEAR, SoundSource.BLOCKS, 1.0F, 1.0F);
-                dropHoneycomb(world, pos);
+                // Paper start - Add PlayerShearBlockEvent
+                for (org.bukkit.inventory.ItemStack itemDrop : event.getDrops()) {
+                    popResource(world, pos, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(itemDrop));
+                }
+                // Paper end - Add PlayerShearBlockEvent
                 stack.hurtAndBreak(1, player, LivingEntity.getSlotForHand(hand));
-                bl = true;
-                world.gameEvent(player, GameEvent.SHEAR, pos);
+                flag = true;
+                world.gameEvent((Entity) player, (Holder) GameEvent.SHEAR, pos);
             } else if (stack.is(Items.GLASS_BOTTLE)) {
                 stack.shrink(1);
                 world.playSound(player, player.getX(), player.getY(), player.getZ(), SoundEvents.BOTTLE_FILL, SoundSource.BLOCKS, 1.0F, 1.0F);
@@ -141,16 +164,16 @@
                     player.drop(new ItemStack(Items.HONEY_BOTTLE), false);
                 }
 
-                bl = true;
-                world.gameEvent(player, GameEvent.FLUID_PICKUP, pos);
+                flag = true;
+                world.gameEvent((Entity) player, (Holder) GameEvent.FLUID_PICKUP, pos);
             }
 
-            if (!world.isClientSide() && bl) {
+            if (!world.isClientSide() && flag) {
                 player.awardStat(Stats.ITEM_USED.get(item));
             }
         }
 
-        if (bl) {
+        if (flag) {
             if (!CampfireBlock.isSmokeyPos(world, pos)) {
                 if (this.hiveContainsBees(world, pos)) {
                     this.angerNearbyBees(world, pos);
@@ -168,83 +191,80 @@
     }
 
     private boolean hiveContainsBees(Level world, BlockPos pos) {
-        return world.getBlockEntity(pos) instanceof BeehiveBlockEntity beehiveBlockEntity && !beehiveBlockEntity.isEmpty();
+        BlockEntity tileentity = world.getBlockEntity(pos);
+
+        if (tileentity instanceof BeehiveBlockEntity tileentitybeehive) {
+            return !tileentitybeehive.isEmpty();
+        } else {
+            return false;
+        }
     }
 
-    public void releaseBeesAndResetHoneyLevel(
-        Level world, BlockState state, BlockPos pos, @Nullable Player player, BeehiveBlockEntity.BeeReleaseStatus beeState
-    ) {
+    public void releaseBeesAndResetHoneyLevel(Level world, BlockState state, BlockPos pos, @Nullable Player player, BeehiveBlockEntity.BeeReleaseStatus beeState) {
         this.resetHoneyLevel(world, state, pos);
-        if (world.getBlockEntity(pos) instanceof BeehiveBlockEntity beehiveBlockEntity) {
-            beehiveBlockEntity.emptyAllLivingFromHive(player, state, beeState);
+        BlockEntity tileentity = world.getBlockEntity(pos);
+
+        if (tileentity instanceof BeehiveBlockEntity tileentitybeehive) {
+            tileentitybeehive.emptyAllLivingFromHive(player, state, beeState);
         }
+
     }
 
     public void resetHoneyLevel(Level world, BlockState state, BlockPos pos) {
-        world.setBlock(pos, state.setValue(HONEY_LEVEL, Integer.valueOf(0)), 3);
+        world.setBlock(pos, (BlockState) state.setValue(BeehiveBlock.HONEY_LEVEL, 0), 3);
     }
 
     @Override
     public void animateTick(BlockState state, Level world, BlockPos pos, RandomSource random) {
-        if (state.getValue(HONEY_LEVEL) >= 5) {
-            for (int i = 0; i < random.nextInt(1) + 1; i++) {
+        if ((Integer) state.getValue(BeehiveBlock.HONEY_LEVEL) >= 5) {
+            for (int i = 0; i < random.nextInt(1) + 1; ++i) {
                 this.trySpawnDripParticles(world, pos, state);
             }
         }
+
     }
 
     private void trySpawnDripParticles(Level world, BlockPos pos, BlockState state) {
-        if (state.getFluidState().isEmpty() && !(world.random.nextFloat() < 0.3F)) {
-            VoxelShape voxelShape = state.getCollisionShape(world, pos);
-            double d = voxelShape.max(Direction.Axis.Y);
-            if (d >= 1.0 && !state.is(BlockTags.IMPERMEABLE)) {
-                double e = voxelShape.min(Direction.Axis.Y);
-                if (e > 0.0) {
-                    this.spawnParticle(world, pos, voxelShape, (double)pos.getY() + e - 0.05);
+        if (state.getFluidState().isEmpty() && world.random.nextFloat() >= 0.3F) {
+            VoxelShape voxelshape = state.getCollisionShape(world, pos);
+            double d0 = voxelshape.max(Direction.Axis.Y);
+
+            if (d0 >= 1.0D && !state.is(BlockTags.IMPERMEABLE)) {
+                double d1 = voxelshape.min(Direction.Axis.Y);
+
+                if (d1 > 0.0D) {
+                    this.spawnParticle(world, pos, voxelshape, (double) pos.getY() + d1 - 0.05D);
                 } else {
-                    BlockPos blockPos = pos.below();
-                    BlockState blockState = world.getBlockState(blockPos);
-                    VoxelShape voxelShape2 = blockState.getCollisionShape(world, blockPos);
-                    double f = voxelShape2.max(Direction.Axis.Y);
-                    if ((f < 1.0 || !blockState.isCollisionShapeFullBlock(world, blockPos)) && blockState.getFluidState().isEmpty()) {
-                        this.spawnParticle(world, pos, voxelShape, (double)pos.getY() - 0.05);
+                    BlockPos blockposition1 = pos.below();
+                    BlockState iblockdata1 = world.getBlockState(blockposition1);
+                    VoxelShape voxelshape1 = iblockdata1.getCollisionShape(world, blockposition1);
+                    double d2 = voxelshape1.max(Direction.Axis.Y);
+
+                    if ((d2 < 1.0D || !iblockdata1.isCollisionShapeFullBlock(world, blockposition1)) && iblockdata1.getFluidState().isEmpty()) {
+                        this.spawnParticle(world, pos, voxelshape, (double) pos.getY() - 0.05D);
                     }
                 }
             }
+
         }
     }
 
     private void spawnParticle(Level world, BlockPos pos, VoxelShape shape, double height) {
-        this.spawnFluidParticle(
-            world,
-            (double)pos.getX() + shape.min(Direction.Axis.X),
-            (double)pos.getX() + shape.max(Direction.Axis.X),
-            (double)pos.getZ() + shape.min(Direction.Axis.Z),
-            (double)pos.getZ() + shape.max(Direction.Axis.Z),
-            height
-        );
+        this.spawnFluidParticle(world, (double) pos.getX() + shape.min(Direction.Axis.X), (double) pos.getX() + shape.max(Direction.Axis.X), (double) pos.getZ() + shape.min(Direction.Axis.Z), (double) pos.getZ() + shape.max(Direction.Axis.Z), height);
     }
 
     private void spawnFluidParticle(Level world, double minX, double maxX, double minZ, double maxZ, double height) {
-        world.addParticle(
-            ParticleTypes.DRIPPING_HONEY,
-            Mth.lerp(world.random.nextDouble(), minX, maxX),
-            height,
-            Mth.lerp(world.random.nextDouble(), minZ, maxZ),
-            0.0,
-            0.0,
-            0.0
-        );
+        world.addParticle(ParticleTypes.DRIPPING_HONEY, Mth.lerp(world.random.nextDouble(), minX, maxX), height, Mth.lerp(world.random.nextDouble(), minZ, maxZ), 0.0D, 0.0D, 0.0D);
     }
 
     @Override
     public BlockState getStateForPlacement(BlockPlaceContext ctx) {
-        return this.defaultBlockState().setValue(FACING, ctx.getHorizontalDirection().getOpposite());
+        return (BlockState) this.defaultBlockState().setValue(BeehiveBlock.FACING, ctx.getHorizontalDirection().getOpposite());
     }
 
     @Override
     protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
-        builder.add(HONEY_LEVEL, FACING);
+        builder.add(BeehiveBlock.HONEY_LEVEL, BeehiveBlock.FACING);
     }
 
     @Override
@@ -266,19 +286,24 @@
 
     @Override
     public BlockState playerWillDestroy(Level world, BlockPos pos, BlockState state, Player player) {
-        if (!world.isClientSide
-            && player.isCreative()
-            && world.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS)
-            && world.getBlockEntity(pos) instanceof BeehiveBlockEntity beehiveBlockEntity) {
-            int i = state.getValue(HONEY_LEVEL);
-            boolean bl = !beehiveBlockEntity.isEmpty();
-            if (bl || i > 0) {
-                ItemStack itemStack = new ItemStack(this);
-                itemStack.applyComponents(beehiveBlockEntity.collectComponents());
-                itemStack.set(DataComponents.BLOCK_STATE, BlockItemStateProperties.EMPTY.with(HONEY_LEVEL, i));
-                ItemEntity itemEntity = new ItemEntity(world, (double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), itemStack);
-                itemEntity.setDefaultPickUpDelay();
-                world.addFreshEntity(itemEntity);
+        if (!world.isClientSide && player.isCreative() && world.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS)) {
+            BlockEntity tileentity = world.getBlockEntity(pos);
+
+            if (tileentity instanceof BeehiveBlockEntity) {
+                BeehiveBlockEntity tileentitybeehive = (BeehiveBlockEntity) tileentity;
+                int i = (Integer) state.getValue(BeehiveBlock.HONEY_LEVEL);
+                boolean flag = !tileentitybeehive.isEmpty();
+
+                if (flag || i > 0) {
+                    ItemStack itemstack = new ItemStack(this);
+
+                    itemstack.applyComponents(tileentitybeehive.collectComponents());
+                    itemstack.set(DataComponents.BLOCK_STATE, BlockItemStateProperties.EMPTY.with(BeehiveBlock.HONEY_LEVEL, i)); // CraftBukkit - decompile error
+                    ItemEntity entityitem = new ItemEntity(world, (double) pos.getX(), (double) pos.getY(), (double) pos.getZ(), itemstack);
+
+                    entityitem.setDefaultPickUpDelay();
+                    world.addFreshEntity(entityitem);
+                }
             }
         }
 
@@ -287,15 +312,15 @@
 
     @Override
     protected List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
-        Entity entity = builder.getOptionalParameter(LootContextParams.THIS_ENTITY);
-        if (entity instanceof PrimedTnt
-            || entity instanceof Creeper
-            || entity instanceof WitherSkull
-            || entity instanceof WitherBoss
-            || entity instanceof MinecartTNT) {
-            BlockEntity blockEntity = builder.getOptionalParameter(LootContextParams.BLOCK_ENTITY);
-            if (blockEntity instanceof BeehiveBlockEntity beehiveBlockEntity) {
-                beehiveBlockEntity.emptyAllLivingFromHive(null, state, BeehiveBlockEntity.BeeReleaseStatus.EMERGENCY);
+        Entity entity = (Entity) builder.getOptionalParameter(LootContextParams.THIS_ENTITY);
+
+        if (entity instanceof PrimedTnt || entity instanceof Creeper || entity instanceof WitherSkull || entity instanceof WitherBoss || entity instanceof MinecartTNT) {
+            BlockEntity tileentity = (BlockEntity) builder.getOptionalParameter(LootContextParams.BLOCK_ENTITY);
+
+            if (tileentity instanceof BeehiveBlockEntity) {
+                BeehiveBlockEntity tileentitybeehive = (BeehiveBlockEntity) tileentity;
+
+                tileentitybeehive.emptyAllLivingFromHive((Player) null, state, BeehiveBlockEntity.BeeReleaseStatus.EMERGENCY);
             }
         }
 
@@ -304,8 +329,14 @@
 
     @Override
     protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
-        if (world.getBlockState(neighborPos).getBlock() instanceof FireBlock && world.getBlockEntity(pos) instanceof BeehiveBlockEntity beehiveBlockEntity) {
-            beehiveBlockEntity.emptyAllLivingFromHive(null, state, BeehiveBlockEntity.BeeReleaseStatus.EMERGENCY);
+        if (world.getBlockState(neighborPos).getBlock() instanceof FireBlock) {
+            BlockEntity tileentity = world.getBlockEntity(pos);
+
+            if (tileentity instanceof BeehiveBlockEntity) {
+                BeehiveBlockEntity tileentitybeehive = (BeehiveBlockEntity) tileentity;
+
+                tileentitybeehive.emptyAllLivingFromHive((Player) null, state, BeehiveBlockEntity.BeeReleaseStatus.EMERGENCY);
+            }
         }
 
         return super.updateShape(state, direction, neighborState, world, pos, neighborPos);
@@ -313,11 +344,11 @@
 
     @Override
     public BlockState rotate(BlockState state, Rotation rotation) {
-        return state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
+        return (BlockState) state.setValue(BeehiveBlock.FACING, rotation.rotate((Direction) state.getValue(BeehiveBlock.FACING)));
     }
 
     @Override
     public BlockState mirror(BlockState state, Mirror mirror) {
-        return state.rotate(mirror.getRotation(state.getValue(FACING)));
+        return state.rotate(mirror.getRotation((Direction) state.getValue(BeehiveBlock.FACING)));
     }
 }
