From 03f1aec110b40d4d9921cef18c562f0fef57ec0a Mon Sep 17 00:00:00 2001 From: Encode42 Date: Thu, 13 May 2021 18:33:52 -0400 Subject: [PATCH] Config for health to impact Creeper explosion radius (#304) --- ...h-to-impact-Creeper-explosion-radius.patch | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 patches/server/0210-Config-for-health-to-impact-Creeper-explosion-radius.patch diff --git a/patches/server/0210-Config-for-health-to-impact-Creeper-explosion-radius.patch b/patches/server/0210-Config-for-health-to-impact-Creeper-explosion-radius.patch new file mode 100644 index 000000000..3ef06697b --- /dev/null +++ b/patches/server/0210-Config-for-health-to-impact-Creeper-explosion-radius.patch @@ -0,0 +1,42 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Encode42 +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/EntityCreeper.java b/src/main/java/net/minecraft/world/entity/monster/EntityCreeper.java +index 27d5e9fc5ec1396e95180fc14e8a61b030cfd1e6..d2ae28bb1a2db6dde2aa7c95589656b6eaf3072d 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntityCreeper.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityCreeper.java +@@ -341,9 +341,10 @@ public class EntityCreeper extends EntityMonster { + if (!this.world.isClientSide) { + Explosion.Effect explosion_effect = this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING) && world.purpurConfig.creeperAllowGriefing ? Explosion.Effect.DESTROY : Explosion.Effect.NONE; // Purpur + float f = this.isPowered() ? 2.0F : 1.0F; ++ float multiplier = this.world.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(), multiplier * (this.explosionRadius * f), false); // Purpur + this.world.getServer().getPluginManager().callEvent(event); + if (!event.isCancelled()) { + this.killed = true; +diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +index b8622f687b4fd70aaee5fa44cc50b8ee38582582..5659e75177f3c5acb935b0f6dc0b720853602108 100644 +--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java ++++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +@@ -830,6 +830,7 @@ public class PurpurWorldConfig { + public boolean creeperRidable = false; + public boolean creeperRidableInWater = false; + public boolean creeperExplodeWhenKilled = false; ++ public boolean creeperHealthRadius = false; + public boolean creeperAllowGriefing = true; + public double creeperChargedChance = 0.0D; + public double creeperMaxHealth = 20.0D; +@@ -837,6 +838,7 @@ public class PurpurWorldConfig { + creeperRidable = getBoolean("mobs.creeper.ridable", creeperRidable); + creeperRidableInWater = getBoolean("mobs.creeper.ridable-in-water", creeperRidableInWater); + creeperExplodeWhenKilled = getBoolean("mobs.creeper.explode-when-killed", creeperExplodeWhenKilled); ++ creeperHealthRadius = getBoolean("mobs.creeper.health-impacts-explosion", creeperHealthRadius); + creeperAllowGriefing = getBoolean("mobs.creeper.allow-griefing", creeperAllowGriefing); + creeperChargedChance = getDouble("mobs.creeper.naturally-charged-chance", creeperChargedChance); + if (PurpurConfig.version < 10) {