From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Encode42 <me@encode42.dev>
Date: Thu, 29 Apr 2021 20:28:18 -0400
Subject: [PATCH] Config for health to impact Creeper explosion radius


diff --git a/src/main/java/net/minecraft/world/entity/monster/Creeper.java b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
index 02494dcc8a342f65b2855612aebeb019095abf65..d66c8866f3c6b1412a6c1876c62e3b29316a0923 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
@@ -352,9 +352,10 @@ public class Creeper extends Monster implements PowerableMob {
         if (!this.level.isClientSide) {
             Explosion.BlockInteraction explosion_effect = (this.level.purpurConfig.creeperBypassMobGriefing || this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && level.purpurConfig.creeperAllowGriefing ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.NONE; // Purpur
             float f = this.isPowered() ? 2.0F : 1.0F;
+            float multiplier = this.level.purpurConfig.creeperHealthRadius ? this.getHealth() / this.getMaxHealth() : 1; // Purpur
 
             // CraftBukkit start
-            ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), this.explosionRadius * f, false);
+            ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), (this.explosionRadius * f) * multiplier, false); // Purpur
             this.level.getCraftServer().getPluginManager().callEvent(event);
             if (!event.isCancelled()) {
                 this.dead = true;
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index fcc7b33320de3522a905ba705e28187a9dbf7394..2f8dc8c296624a07c469c56aecbdd524527fd81b 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -893,6 +893,7 @@ public class PurpurWorldConfig {
     public boolean creeperAllowGriefing = true;
     public boolean creeperBypassMobGriefing = false;
     public boolean creeperExplodeWhenKilled = false;
+    public boolean creeperHealthRadius = false;
     private void creeperSettings() {
         creeperRidable = getBoolean("mobs.creeper.ridable", creeperRidable);
         creeperRidableInWater = getBoolean("mobs.creeper.ridable-in-water", creeperRidableInWater);
@@ -906,6 +907,7 @@ public class PurpurWorldConfig {
         creeperAllowGriefing = getBoolean("mobs.creeper.allow-griefing", creeperAllowGriefing);
         creeperBypassMobGriefing = getBoolean("mobs.creeper.bypass-mob-griefing", creeperBypassMobGriefing);
         creeperExplodeWhenKilled = getBoolean("mobs.creeper.explode-when-killed", creeperExplodeWhenKilled);
+        creeperHealthRadius = getBoolean("mobs.creeper.health-impacts-explosion", creeperHealthRadius);
     }
 
     public boolean dolphinRidable = false;
