Files
Purpur/patches/server/0132-Customizable-WitherBoss-Health-and-Healing.patch
William Blake Galbreath e0c5a02e03 Updated Upstream (Paper)
Upstream has released updates that appears to apply and compile correctly

Paper Changes:
862b8c18 Updated Upstream (Bukkit/CraftBukkit)
100d51eb Do not obfuscate air (#4149)
2020-08-20 21:22:36 -05:00

67 lines
3.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: jmp <jasonpenilla2@me.com>
Date: Thu, 20 Aug 2020 17:38:12 -0700
Subject: [PATCH] Customizable WitherBoss Health and Healing
Adds the ability to customize the health of the Wither Boss, as well as the amount that it heals, and how often in the PurpurWorldConfig.
diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java
index 1511212cbf..78a5449d1c 100644
--- a/src/main/java/net/minecraft/server/EntityWither.java
+++ b/src/main/java/net/minecraft/server/EntityWither.java
@@ -36,6 +36,11 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
public EntityWither(EntityTypes<? extends EntityWither> entitytypes, World world) {
super(entitytypes, world);
this.bossBattle = (BossBattleServer) (new BossBattleServer(this.getScoreboardDisplayName(), BossBattle.BarColor.PURPLE, BossBattle.BarStyle.PROGRESS)).setDarkenSky(true);
+ // Purpur start
+ if (world != null) {
+ this.getAttributeInstance(GenericAttributes.MAX_HEALTH).setValue(world.purpurConfig.witherBossMaxHealth);
+ }
+ // Purpur end
this.setHealth(this.getMaxHealth());
this.getNavigation().d(true);
this.f = 50;
@@ -230,7 +235,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
this.setInvul(i);
if (this.ticksLived % 10 == 0) {
- this.heal(10.0F, EntityRegainHealthEvent.RegainReason.WITHER_SPAWN); // CraftBukkit
+ this.heal(this.getMaxHealth() / 33, EntityRegainHealthEvent.RegainReason.WITHER_SPAWN); // CraftBukkit // Purpur - use max health for healing instead of a constant
}
} else {
@@ -339,9 +344,11 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
}
}
- if (this.ticksLived % 20 == 0) {
- this.heal(1.0F, EntityRegainHealthEvent.RegainReason.REGEN); // CraftBukkit
+ // Purpur start - customizable heal rate and amount
+ if (this.ticksLived % world.purpurConfig.witherBossHealthRegenDelay == 0) {
+ this.heal(world.purpurConfig.witherBossHealthRegenAmount, EntityRegainHealthEvent.RegainReason.REGEN); // CraftBukkit
}
+ // Purpur end
this.bossBattle.setProgress(this.getHealth() / this.getMaxHealth());
}
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index d19c6d13cf..aaf1735e66 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -887,6 +887,15 @@ public class PurpurWorldConfig {
witherSkeletonTakesWitherDamage = getBoolean("mobs.wither_skeleton.takes-wither-damage", witherSkeletonTakesWitherDamage);
}
+ public double witherBossMaxHealth = 300.0D;
+ public float witherBossHealthRegenAmount = 1.0f;
+ public int witherBossHealthRegenDelay = 20;
+ private void witherSettings() {
+ witherBossMaxHealth = getDouble("mobs.wither_boss.max-health", witherBossMaxHealth);
+ witherBossHealthRegenAmount = (float) getDouble("mobs.wither_boss.health-regen-amount", witherBossHealthRegenAmount);
+ witherBossHealthRegenDelay = getInt("mobs.wither_boss.health-regen-delay", witherBossHealthRegenDelay);
+ }
+
public boolean wolfRidable = false;
public boolean wolfRidableInWater = false;
private void wolfSettings() {