From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Thu, 20 Aug 2020 17:38:12 -0700 Subject: [PATCH] Customizable wither health and healing Adds the ability to customize the health of the wither, as well as the amount that it heals, and how often. diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java index 87a0d264d9b54e1b0b29f49431212c977864a30a..87c5dd63bd4a0dd045b5ff30105217562af7967c 100644 --- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java +++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java @@ -399,8 +399,10 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob } } - if (this.tickCount % 20 == 0) { - this.heal(1.0F, EntityRegainHealthEvent.RegainReason.REGEN); // CraftBukkit + // Purpur start - customizable heal rate and amount + if (this.tickCount % level.purpurConfig.witherHealthRegenDelay == 0) { + this.heal(level.purpurConfig.witherHealthRegenAmount, EntityRegainHealthEvent.RegainReason.REGEN); // CraftBukkit + // Purpur end } this.bossEvent.setProgress(this.getHealth() / this.getMaxHealth()); diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java index 8883a6364f0245f2814fab1bdf8ce8da4b625ae0..c4fbdb55b9f9b90a7fe6ed6ac84e7e775d163b65 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -1273,6 +1273,8 @@ public class PurpurWorldConfig { } public double witherMaxHealth = 300.0D; + public float witherHealthRegenAmount = 1.0f; + public int witherHealthRegenDelay = 20; private void witherSettings() { if (PurpurConfig.version < 8) { double oldValue = getDouble("mobs.wither.max-health", witherMaxHealth); @@ -1284,6 +1286,8 @@ public class PurpurWorldConfig { set("mobs.wither.attributes.max_health", oldValue); } witherMaxHealth = getDouble("mobs.wither.attributes.max_health", witherMaxHealth); + witherHealthRegenAmount = (float) getDouble("mobs.wither.health-regen-amount", witherHealthRegenAmount); + witherHealthRegenDelay = getInt("mobs.wither.health-regen-delay", witherHealthRegenDelay); } public double witherSkeletonMaxHealth = 20.0D;