--- a/net/minecraft/world/level/ServerExplosion.java
+++ b/net/minecraft/world/level/ServerExplosion.java
@@ -35,6 +35,13 @@
 import net.minecraft.world.phys.MovingObjectPosition;
 import net.minecraft.world.phys.Vec3D;
 
+// CraftBukkit start
+import net.minecraft.world.entity.boss.EntityComplexPart;
+import net.minecraft.world.entity.boss.enderdragon.EntityEnderDragon;
+import net.minecraft.world.level.block.Blocks;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+// CraftBukkit end
+
 public class ServerExplosion implements Explosion {
 
     private static final ExplosionDamageCalculator EXPLOSION_DAMAGE_CALCULATOR = new ExplosionDamageCalculator();
@@ -50,16 +57,21 @@
     private final DamageSource damageSource;
     private final ExplosionDamageCalculator damageCalculator;
     private final Map<EntityHuman, Vec3D> hitPlayers = new HashMap();
+    // CraftBukkit - add field
+    public boolean wasCanceled = false;
+    public float yield;
+    // CraftBukkit end
 
     public ServerExplosion(WorldServer worldserver, @Nullable Entity entity, @Nullable DamageSource damagesource, @Nullable ExplosionDamageCalculator explosiondamagecalculator, Vec3D vec3d, float f, boolean flag, Explosion.Effect explosion_effect) {
         this.level = worldserver;
         this.source = entity;
-        this.radius = f;
+        this.radius = (float) Math.max(f, 0.0); // CraftBukkit - clamp bad values
         this.center = vec3d;
         this.fire = flag;
         this.blockInteraction = explosion_effect;
         this.damageSource = damagesource == null ? worldserver.damageSources().explosion(this) : damagesource;
         this.damageCalculator = explosiondamagecalculator == null ? this.makeDamageCalculator(entity) : explosiondamagecalculator;
+        this.yield = this.blockInteraction == Explosion.Effect.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F; // CraftBukkit
     }
 
     private ExplosionDamageCalculator makeDamageCalculator(@Nullable Entity entity) {
@@ -195,7 +207,35 @@
                         float f2 = !flag && f1 == 0.0F ? 0.0F : getSeenPercent(this.center, entity);
 
                         if (flag) {
-                            entity.hurtServer(this.level, this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entity, f2));
+                            // CraftBukkit start
+
+                            // Special case ender dragon only give knockback if no damage is cancelled
+                            // Thinks to note:
+                            // - Setting a velocity to a ComplexEntityPart is ignored (and therefore not needed)
+                            // - Damaging ComplexEntityPart while forward the damage to EntityEnderDragon
+                            // - Damaging EntityEnderDragon does nothing
+                            // - EntityEnderDragon hitbock always covers the other parts and is therefore always present
+                            if (entity instanceof EntityComplexPart) {
+                                continue;
+                            }
+
+                            entity.lastDamageCancelled = false;
+
+                            if (entity instanceof EntityEnderDragon) {
+                                for (EntityComplexPart entityComplexPart : ((EntityEnderDragon) entity).subEntities) {
+                                    // Calculate damage separately for each EntityComplexPart
+                                    if (list.contains(entityComplexPart)) {
+                                        entityComplexPart.hurtServer(this.level, this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entity, f2));
+                                    }
+                                }
+                            } else {
+                                entity.hurtServer(this.level, this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entity, f2));
+                            }
+
+                            if (entity.lastDamageCancelled) { // SPIGOT-5339, SPIGOT-6252, SPIGOT-6777: Skip entity if damage event was cancelled
+                                continue;
+                            }
+                            // CraftBukkit end
                         }
 
                         double d5 = (1.0D - d0) * (double) f2 * (double) f1;
@@ -214,6 +254,17 @@
                         d3 *= d6;
                         Vec3D vec3d = new Vec3D(d1, d2, d3);
 
+                        // CraftBukkit start - Call EntityKnockbackEvent
+                        if (entity instanceof EntityLiving) {
+                            Vec3D result = entity.getDeltaMovement().add(vec3d);
+                            org.bukkit.event.entity.EntityKnockbackEvent event = CraftEventFactory.callEntityKnockbackEvent((org.bukkit.craftbukkit.entity.CraftLivingEntity) entity.getBukkitEntity(), source, org.bukkit.event.entity.EntityKnockbackEvent.KnockbackCause.EXPLOSION, d6, vec3d, result.x, result.y, result.z);
+
+                            // SPIGOT-7640: Need to subtract entity movement from the event result,
+                            // since the code below (the setDeltaMovement call as well as the hitPlayers map)
+                            // want the vector to be the relative velocity will the event provides the absolute velocity
+                            vec3d = (event.isCancelled()) ? Vec3D.ZERO : new Vec3D(event.getFinalKnockback().getX(), event.getFinalKnockback().getY(), event.getFinalKnockback().getZ()).subtract(entity.getDeltaMovement());
+                        }
+                        // CraftBukkit end
                         entity.push(vec3d);
                         if (entity instanceof EntityHuman) {
                             EntityHuman entityhuman = (EntityHuman) entity;
@@ -235,10 +286,31 @@
         List<ServerExplosion.a> list1 = new ArrayList();
 
         SystemUtils.shuffle(list, this.level.random);
+        // CraftBukkit start
+        List<org.bukkit.block.Block> bukkitBlocks = CraftEventFactory.handleExplodeEvent(this, list);
+
+        list.clear();
+        list.addAll(bukkitBlocks.stream().map(bblock -> new BlockPosition(bblock.getX(), bblock.getY(), bblock.getZ())).toList());
+
+        if (this.wasCanceled) {
+            return;
+        }
+        // CraftBukkit end
         Iterator iterator = list.iterator();
 
         while (iterator.hasNext()) {
             BlockPosition blockposition = (BlockPosition) iterator.next();
+            // CraftBukkit start - TNTPrimeEvent
+            IBlockData iblockdata = this.level.getBlockState(blockposition);
+            Block block = iblockdata.getBlock();
+            if (block instanceof net.minecraft.world.level.block.BlockTNT) {
+                BlockPosition sourceBlock = source == null ? BlockPosition.containing(this.center) : null;
+                if (!CraftEventFactory.callTNTPrimeEvent(this.level, blockposition, org.bukkit.event.block.TNTPrimeEvent.PrimeCause.EXPLOSION, source, sourceBlock)) {
+                    this.level.sendBlockUpdated(blockposition, Blocks.AIR.defaultBlockState(), iblockdata, 3); // Update the block on the client
+                    continue;
+                }
+            }
+            // CraftBukkit end
 
             this.level.getBlockState(blockposition).onExplosionHit(this.level, blockposition, this, (itemstack, blockposition1) -> {
                 addOrAppendStack(list1, itemstack, blockposition1);
@@ -262,13 +334,22 @@
             BlockPosition blockposition = (BlockPosition) iterator.next();
 
             if (this.level.random.nextInt(3) == 0 && this.level.getBlockState(blockposition).isAir() && this.level.getBlockState(blockposition.below()).isSolidRender()) {
-                this.level.setBlockAndUpdate(blockposition, BlockFireAbstract.getState(this.level, blockposition));
+                // CraftBukkit start - Ignition by explosion
+                if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(this.level, blockposition, this).isCancelled()) {
+                    this.level.setBlockAndUpdate(blockposition, BlockFireAbstract.getState(this.level, blockposition));
+                }
+                // CraftBukkit end
             }
         }
 
     }
 
     public void explode() {
+        // CraftBukkit start
+        if (this.radius < 0.1F) {
+            return;
+        }
+        // CraftBukkit end
         this.level.gameEvent(this.source, (Holder) GameEvent.EXPLODE, this.center);
         List<BlockPosition> list = this.calculateExplodedPositions();
 
@@ -279,7 +360,15 @@
             gameprofilerfiller.push("explosion_blocks");
             this.interactWithBlocks(list);
             gameprofilerfiller.pop();
+            // CraftBukkit start - handle KEEP effect
+        } else {
+            SystemUtils.shuffle(list, this.level.random); // CraftBukkit - Copy from calculateExplodedPositions
+            List<org.bukkit.block.Block> bukkitBlocks = CraftEventFactory.handleExplodeEvent(this, list);
+
+            list.clear();
+            list.addAll(bukkitBlocks.stream().map(bblock -> new BlockPosition(bblock.getX(), bblock.getY(), bblock.getZ())).toList());
         }
+        // CraftBukkit end
 
         if (this.fire) {
             this.createFire(list);
@@ -288,6 +377,7 @@
     }
 
     private static void addOrAppendStack(List<ServerExplosion.a> list, ItemStack itemstack, BlockPosition blockposition) {
+        if (itemstack.isEmpty()) return; // CraftBukkit - SPIGOT-5425
         Iterator iterator = list.iterator();
 
         do {
