--- a/net/minecraft/world/entity/monster/Creeper.java
+++ b/net/minecraft/world/entity/monster/Creeper.java
@@ -1,6 +1,7 @@
 package net.minecraft.world.entity.monster;
 
 import java.util.Collection;
+import java.util.Iterator;
 import javax.annotation.Nullable;
 import net.minecraft.nbt.CompoundTag;
 import net.minecraft.network.syncher.EntityDataAccessor;
@@ -38,10 +39,19 @@
 import net.minecraft.world.entity.player.Player;
 import net.minecraft.world.item.ItemStack;
 import net.minecraft.world.item.Items;
+import net.minecraft.world.level.ItemLike;
 import net.minecraft.world.level.Level;
 import net.minecraft.world.level.gameevent.GameEvent;
 
+// CraftBukkit start;
+import org.bukkit.event.entity.CreatureSpawnEvent;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.event.entity.EntityRemoveEvent;
+import org.bukkit.event.entity.ExplosionPrimeEvent;
+// CraftBukkit end
+
 public class Creeper extends Monster implements PowerableMob {
+
     private static final EntityDataAccessor<Integer> DATA_SWELL_DIR = SynchedEntityData.defineId(Creeper.class, EntityDataSerializers.INT);
     private static final EntityDataAccessor<Boolean> DATA_IS_POWERED = SynchedEntityData.defineId(Creeper.class, EntityDataSerializers.BOOLEAN);
     private static final EntityDataAccessor<Boolean> DATA_IS_IGNITED = SynchedEntityData.defineId(Creeper.class, EntityDataSerializers.BOOLEAN);
@@ -50,6 +60,7 @@
     public int maxSwell = 30;
     public int explosionRadius = 3;
     private int droppedSkulls;
+    private Player entityIgniter; // CraftBukkit
 
     public Creeper(EntityType<? extends Creeper> type, Level world) {
         super(type, world);
@@ -59,18 +70,18 @@
     protected void registerGoals() {
         this.goalSelector.addGoal(1, new FloatGoal(this));
         this.goalSelector.addGoal(2, new SwellGoal(this));
-        this.goalSelector.addGoal(3, new AvoidEntityGoal<>(this, Ocelot.class, 6.0F, 1.0, 1.2));
-        this.goalSelector.addGoal(3, new AvoidEntityGoal<>(this, Cat.class, 6.0F, 1.0, 1.2));
-        this.goalSelector.addGoal(4, new MeleeAttackGoal(this, 1.0, false));
-        this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 0.8));
+        this.goalSelector.addGoal(3, new AvoidEntityGoal<>(this, Ocelot.class, 6.0F, 1.0D, 1.2D));
+        this.goalSelector.addGoal(3, new AvoidEntityGoal<>(this, Cat.class, 6.0F, 1.0D, 1.2D));
+        this.goalSelector.addGoal(4, new MeleeAttackGoal(this, 1.0D, false));
+        this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 0.8D));
         this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 8.0F));
         this.goalSelector.addGoal(6, new RandomLookAroundGoal(this));
         this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, Player.class, true));
-        this.targetSelector.addGoal(2, new HurtByTargetGoal(this));
+        this.targetSelector.addGoal(2, new HurtByTargetGoal(this, new Class[0]));
     }
 
     public static AttributeSupplier.Builder createAttributes() {
-        return Monster.createMonsterAttributes().add(Attributes.MOVEMENT_SPEED, 0.25);
+        return Monster.createMonsterAttributes().add(Attributes.MOVEMENT_SPEED, 0.25D);
     }
 
     @Override
@@ -80,39 +91,40 @@
 
     @Override
     public boolean causeFallDamage(float fallDistance, float damageMultiplier, DamageSource damageSource) {
-        boolean bl = super.causeFallDamage(fallDistance, damageMultiplier, damageSource);
-        this.swell += (int)(fallDistance * 1.5F);
+        boolean flag = super.causeFallDamage(fallDistance, damageMultiplier, damageSource);
+
+        this.swell += (int) (fallDistance * 1.5F);
         if (this.swell > this.maxSwell - 5) {
             this.swell = this.maxSwell - 5;
         }
 
-        return bl;
+        return flag;
     }
 
     @Override
     protected void defineSynchedData(SynchedEntityData.Builder builder) {
         super.defineSynchedData(builder);
-        builder.define(DATA_SWELL_DIR, -1);
-        builder.define(DATA_IS_POWERED, false);
-        builder.define(DATA_IS_IGNITED, false);
+        builder.define(Creeper.DATA_SWELL_DIR, -1);
+        builder.define(Creeper.DATA_IS_POWERED, false);
+        builder.define(Creeper.DATA_IS_IGNITED, false);
     }
 
     @Override
     public void addAdditionalSaveData(CompoundTag nbt) {
         super.addAdditionalSaveData(nbt);
-        if (this.entityData.get(DATA_IS_POWERED)) {
+        if ((Boolean) this.entityData.get(Creeper.DATA_IS_POWERED)) {
             nbt.putBoolean("powered", true);
         }
 
-        nbt.putShort("Fuse", (short)this.maxSwell);
-        nbt.putByte("ExplosionRadius", (byte)this.explosionRadius);
+        nbt.putShort("Fuse", (short) this.maxSwell);
+        nbt.putByte("ExplosionRadius", (byte) this.explosionRadius);
         nbt.putBoolean("ignited", this.isIgnited());
     }
 
     @Override
     public void readAdditionalSaveData(CompoundTag nbt) {
         super.readAdditionalSaveData(nbt);
-        this.entityData.set(DATA_IS_POWERED, nbt.getBoolean("powered"));
+        this.entityData.set(Creeper.DATA_IS_POWERED, nbt.getBoolean("powered"));
         if (nbt.contains("Fuse", 99)) {
             this.maxSwell = nbt.getShort("Fuse");
         }
@@ -122,8 +134,9 @@
         }
 
         if (nbt.getBoolean("ignited")) {
-            this.ignite();
+            this.entityData.set(Creeper.DATA_IS_IGNITED, true); // Paper - set directly to avoid firing event
         }
+
     }
 
     @Override
@@ -135,6 +148,7 @@
             }
 
             int i = this.getSwellDir();
+
             if (i > 0 && this.swell == 0) {
                 this.playSound(SoundEvents.CREEPER_PRIMED, 1.0F, 0.5F);
                 this.gameEvent(GameEvent.PRIME_FUSE);
@@ -175,10 +189,14 @@
     protected void dropCustomDeathLoot(ServerLevel world, DamageSource source, boolean causedByPlayer) {
         super.dropCustomDeathLoot(world, source, causedByPlayer);
         Entity entity = source.getEntity();
-        if (entity != this && entity instanceof Creeper creeper && creeper.canDropMobsSkull()) {
-            creeper.increaseDroppedSkulls();
-            this.spawnAtLocation(Items.CREEPER_HEAD);
+
+        if (entity != this && entity instanceof Creeper entitycreeper) {
+            if (entitycreeper.canDropMobsSkull()) {
+                entitycreeper.increaseDroppedSkulls();
+                this.spawnAtLocation((ItemLike) Items.CREEPER_HEAD);
+            }
         }
+
     }
 
     @Override
@@ -188,40 +206,53 @@
 
     @Override
     public boolean isPowered() {
-        return this.entityData.get(DATA_IS_POWERED);
+        return (Boolean) this.entityData.get(Creeper.DATA_IS_POWERED);
     }
 
     public float getSwelling(float timeDelta) {
-        return Mth.lerp(timeDelta, (float)this.oldSwell, (float)this.swell) / (float)(this.maxSwell - 2);
+        return Mth.lerp(timeDelta, (float) this.oldSwell, (float) this.swell) / (float) (this.maxSwell - 2);
     }
 
     public int getSwellDir() {
-        return this.entityData.get(DATA_SWELL_DIR);
+        return (Integer) this.entityData.get(Creeper.DATA_SWELL_DIR);
     }
 
     public void setSwellDir(int fuseSpeed) {
-        this.entityData.set(DATA_SWELL_DIR, fuseSpeed);
+        this.entityData.set(Creeper.DATA_SWELL_DIR, fuseSpeed);
     }
 
     @Override
     public void thunderHit(ServerLevel world, LightningBolt lightning) {
         super.thunderHit(world, lightning);
-        this.entityData.set(DATA_IS_POWERED, true);
+        // CraftBukkit start
+        if (CraftEventFactory.callCreeperPowerEvent(this, lightning, org.bukkit.event.entity.CreeperPowerEvent.PowerCause.LIGHTNING).isCancelled()) {
+            return;
+        }
+        // CraftBukkit end
+        this.entityData.set(Creeper.DATA_IS_POWERED, true);
     }
 
+    // CraftBukkit start
+    public void setPowered(boolean powered) {
+        this.entityData.set(Creeper.DATA_IS_POWERED, powered);
+    }
+    // CraftBukkit end
+
     @Override
     protected InteractionResult mobInteract(Player player, InteractionHand hand) {
-        ItemStack itemStack = player.getItemInHand(hand);
-        if (itemStack.is(ItemTags.CREEPER_IGNITERS)) {
-            SoundEvent soundEvent = itemStack.is(Items.FIRE_CHARGE) ? SoundEvents.FIRECHARGE_USE : SoundEvents.FLINTANDSTEEL_USE;
-            this.level()
-                .playSound(player, this.getX(), this.getY(), this.getZ(), soundEvent, this.getSoundSource(), 1.0F, this.random.nextFloat() * 0.4F + 0.8F);
+        ItemStack itemstack = player.getItemInHand(hand);
+
+        if (itemstack.is(ItemTags.CREEPER_IGNITERS)) {
+            SoundEvent soundeffect = itemstack.is(Items.FIRE_CHARGE) ? SoundEvents.FIRECHARGE_USE : SoundEvents.FLINTANDSTEEL_USE;
+
+            this.level().playSound(player, this.getX(), this.getY(), this.getZ(), soundeffect, this.getSoundSource(), 1.0F, this.random.nextFloat() * 0.4F + 0.8F);
             if (!this.level().isClientSide) {
+                this.entityIgniter = player; // CraftBukkit
                 this.ignite();
-                if (!itemStack.isDamageableItem()) {
-                    itemStack.shrink(1);
+                if (itemstack.getMaxDamage() == 0) { // CraftBukkit - fix MC-264285: unbreakable flint and steels are completely consumed when igniting a creeper
+                    itemstack.shrink(1);
                 } else {
-                    itemStack.hurtAndBreak(1, player, getSlotForHand(hand));
+                    itemstack.hurtAndBreak(1, player, getSlotForHand(hand));
                 }
             }
 
@@ -234,38 +265,68 @@
     public void explodeCreeper() {
         if (!this.level().isClientSide) {
             float f = this.isPowered() ? 2.0F : 1.0F;
+
+            // CraftBukkit start
+            ExplosionPrimeEvent event = CraftEventFactory.callExplosionPrimeEvent(this, this.explosionRadius * f, false);
+            if (!event.isCancelled()) {
+            // CraftBukkit end
             this.dead = true;
-            this.level().explode(this, this.getX(), this.getY(), this.getZ(), (float)this.explosionRadius * f, Level.ExplosionInteraction.MOB);
+            this.level().explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.MOB); // CraftBukkit // Paper - fix DamageSource API (revert to vanilla, no, just no, don't change this)
             this.spawnLingeringCloud();
             this.triggerOnDeathMobEffects(Entity.RemovalReason.KILLED);
-            this.discard();
+            this.discard(EntityRemoveEvent.Cause.EXPLODE); // CraftBukkit - add Bukkit remove cause
+            // CraftBukkit start
+            } else {
+                this.swell = 0;
+                this.entityData.set(DATA_IS_IGNITED, Boolean.valueOf(false)); // Paper
+            }
+            // CraftBukkit end
         }
+
     }
 
     private void spawnLingeringCloud() {
         Collection<MobEffectInstance> collection = this.getActiveEffects();
-        if (!collection.isEmpty()) {
-            AreaEffectCloud areaEffectCloud = new AreaEffectCloud(this.level(), this.getX(), this.getY(), this.getZ());
-            areaEffectCloud.setRadius(2.5F);
-            areaEffectCloud.setRadiusOnUse(-0.5F);
-            areaEffectCloud.setWaitTime(10);
-            areaEffectCloud.setDuration(areaEffectCloud.getDuration() / 2);
-            areaEffectCloud.setRadiusPerTick(-areaEffectCloud.getRadius() / (float)areaEffectCloud.getDuration());
 
-            for (MobEffectInstance mobEffectInstance : collection) {
-                areaEffectCloud.addEffect(new MobEffectInstance(mobEffectInstance));
+        if (!collection.isEmpty() && !this.level().paperConfig().entities.behavior.disableCreeperLingeringEffect) { // Paper - Option to disable creeper lingering effect
+            AreaEffectCloud entityareaeffectcloud = new AreaEffectCloud(this.level(), this.getX(), this.getY(), this.getZ());
+
+            entityareaeffectcloud.setOwner(this); // CraftBukkit
+            entityareaeffectcloud.setRadius(2.5F);
+            entityareaeffectcloud.setRadiusOnUse(-0.5F);
+            entityareaeffectcloud.setWaitTime(10);
+            entityareaeffectcloud.setDuration(entityareaeffectcloud.getDuration() / 2);
+            entityareaeffectcloud.setRadiusPerTick(-entityareaeffectcloud.getRadius() / (float) entityareaeffectcloud.getDuration());
+            Iterator iterator = collection.iterator();
+
+            while (iterator.hasNext()) {
+                MobEffectInstance mobeffect = (MobEffectInstance) iterator.next();
+
+                entityareaeffectcloud.addEffect(new MobEffectInstance(mobeffect));
             }
 
-            this.level().addFreshEntity(areaEffectCloud);
+            this.level().addFreshEntity(entityareaeffectcloud, CreatureSpawnEvent.SpawnReason.EXPLOSION); // CraftBukkit
         }
+
     }
 
     public boolean isIgnited() {
-        return this.entityData.get(DATA_IS_IGNITED);
+        return (Boolean) this.entityData.get(Creeper.DATA_IS_IGNITED);
     }
 
     public void ignite() {
-        this.entityData.set(DATA_IS_IGNITED, true);
+        // Paper start - CreeperIgniteEvent
+        setIgnited(true);
+    }
+
+    public void setIgnited(boolean ignited) {
+        if (isIgnited() != ignited) {
+            com.destroystokyo.paper.event.entity.CreeperIgniteEvent event = new com.destroystokyo.paper.event.entity.CreeperIgniteEvent((org.bukkit.entity.Creeper) getBukkitEntity(), ignited);
+            if (event.callEvent()) {
+                this.entityData.set(Creeper.DATA_IS_IGNITED, event.isIgnited());
+            }
+        }
+        // Paper end - CreeperIgniteEvent
     }
 
     public boolean canDropMobsSkull() {
@@ -273,6 +334,6 @@
     }
 
     public void increaseDroppedSkulls() {
-        this.droppedSkulls++;
+        ++this.droppedSkulls;
     }
 }
