--- a/net/minecraft/world/level/block/CoralBlock.java
+++ b/net/minecraft/world/level/block/CoralBlock.java
@@ -17,10 +17,13 @@
 import net.minecraft.world.level.material.FluidState;
 
 public class CoralBlock extends Block {
+
     public static final MapCodec<Block> DEAD_CORAL_FIELD = BuiltInRegistries.BLOCK.byNameCodec().fieldOf("dead");
-    public static final MapCodec<CoralBlock> CODEC = RecordCodecBuilder.mapCodec(
-        instance -> instance.group(DEAD_CORAL_FIELD.forGetter(block -> block.deadBlock), propertiesCodec()).apply(instance, CoralBlock::new)
-    );
+    public static final MapCodec<CoralBlock> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
+        return instance.group(CoralBlock.DEAD_CORAL_FIELD.forGetter((blockcoral) -> {
+            return blockcoral.deadBlock;
+        }), propertiesCodec()).apply(instance, CoralBlock::new);
+    });
     private final Block deadBlock;
 
     public CoralBlock(Block deadCoralBlock, BlockBehaviour.Properties settings) {
@@ -30,29 +33,40 @@
 
     @Override
     public MapCodec<CoralBlock> codec() {
-        return CODEC;
+        return CoralBlock.CODEC;
     }
 
     @Override
     protected void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
         if (!this.scanForWater(world, pos)) {
+            // CraftBukkit start
+            if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, pos, this.deadBlock.defaultBlockState()).isCancelled()) {
+                return;
+            }
+            // CraftBukkit end
             world.setBlock(pos, this.deadBlock.defaultBlockState(), 2);
         }
+
     }
 
     @Override
     protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
         if (!this.scanForWater(world, pos)) {
-            world.scheduleTick(pos, this, 60 + world.getRandom().nextInt(40));
+            world.scheduleTick(pos, (Block) this, 60 + world.getRandom().nextInt(40));
         }
 
         return super.updateShape(state, direction, neighborState, world, pos, neighborPos);
     }
 
     protected boolean scanForWater(BlockGetter world, BlockPos pos) {
-        for (Direction direction : Direction.values()) {
-            FluidState fluidState = world.getFluidState(pos.relative(direction));
-            if (fluidState.is(FluidTags.WATER)) {
+        Direction[] aenumdirection = Direction.values();
+        int i = aenumdirection.length;
+
+        for (int j = 0; j < i; ++j) {
+            Direction enumdirection = aenumdirection[j];
+            FluidState fluid = world.getFluidState(pos.relative(enumdirection));
+
+            if (fluid.is(FluidTags.WATER)) {
                 return true;
             }
         }
@@ -64,7 +78,7 @@
     @Override
     public BlockState getStateForPlacement(BlockPlaceContext ctx) {
         if (!this.scanForWater(ctx.getLevel(), ctx.getClickedPos())) {
-            ctx.getLevel().scheduleTick(ctx.getClickedPos(), this, 60 + ctx.getLevel().getRandom().nextInt(40));
+            ctx.getLevel().scheduleTick(ctx.getClickedPos(), (Block) this, 60 + ctx.getLevel().getRandom().nextInt(40));
         }
 
         return this.defaultBlockState();
