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.
This commit is contained in:
Jason Penilla
2025-01-09 15:09:47 -08:00
committed by granny
parent b5517f87dc
commit 6a417631f3
4 changed files with 22 additions and 49 deletions

View File

@@ -1,46 +0,0 @@
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/net/minecraft/world/entity/boss/wither/WitherBoss.java b/net/minecraft/world/entity/boss/wither/WitherBoss.java
index 57cf253fc69c087cfa0270225166f926ce6829f7..098ef0d6879e88009193c6dcedf1aa285980cbc6 100644
--- a/net/minecraft/world/entity/boss/wither/WitherBoss.java
+++ b/net/minecraft/world/entity/boss/wither/WitherBoss.java
@@ -518,8 +518,10 @@ public class WitherBoss extends Monster implements 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 a28548332baf610521a308a560a858b3fc737b60..e323914f8694043e7b08a2518169695f582bc1a8 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -1876,6 +1876,8 @@ public class PurpurWorldConfig {
public double witherMaxY = 320D;
public double witherMaxHealth = 300.0D;
public double witherScale = 1.0D;
+ public float witherHealthRegenAmount = 1.0f;
+ public int witherHealthRegenDelay = 20;
private void witherSettings() {
witherRidable = getBoolean("mobs.wither.ridable", witherRidable);
witherRidableInWater = getBoolean("mobs.wither.ridable-in-water", witherRidableInWater);
@@ -1892,6 +1894,8 @@ public class PurpurWorldConfig {
}
witherMaxHealth = getDouble("mobs.wither.attributes.max_health", witherMaxHealth);
witherScale = Mth.clamp(getDouble("mobs.wither.attributes.scale", witherScale), 0.0625D, 16.0D);
+ witherHealthRegenAmount = (float) getDouble("mobs.wither.health-regen-amount", witherHealthRegenAmount);
+ witherHealthRegenDelay = getInt("mobs.wither.health-regen-delay", witherHealthRegenDelay);
}
public boolean witherSkeletonRidable = false;

View File

@@ -75,7 +75,7 @@ index db9860c44faacdf4b24979c2ffa84515e3883299..1fc37692c7ddfc7b7e0961cd9f060233
if ((target instanceof Bucketable && target instanceof LivingEntity && origItem != null && origItem.asItem() == Items.WATER_BUCKET) && (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelected() == null || ServerGamePacketListenerImpl.this.player.getInventory().getSelected().getItem() != origItem)) {
target.resendPossiblyDesyncedEntityData(ServerGamePacketListenerImpl.this.player); // Paper - The entire mob gets deleted, so resend it
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index d7ebfa3a9951922780e079b9767ce8854c555dd1..7cea12d1c0e28f5d08963009c9c37f324a52d4fe 100644
index f7e17ca9f5011503827f7141d62e556c1cc72fcf..25adb04858ad55dc80a2967e49b3dc0dafe44307 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -3136,6 +3136,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -2795,7 +2795,7 @@ index ef3571155ee5757f6eaab67df0fe530408770071..ca9cca5b1eb8549e99d7a594cb969455
this.dragonFight.updateDragon(this);
}
diff --git a/net/minecraft/world/entity/boss/wither/WitherBoss.java b/net/minecraft/world/entity/boss/wither/WitherBoss.java
index afe43600c4976e01e61d716034a2823d50fb55cb..452fb5473094b713ac456202c3f2f390f8fb7f27 100644
index 3262531c4164dc4420c4a8dff0502cece1a438a5..a38212ad075623b2fa0c37d991aaaf9e1b2bab75 100644
--- a/net/minecraft/world/entity/boss/wither/WitherBoss.java
+++ b/net/minecraft/world/entity/boss/wither/WitherBoss.java
@@ -69,6 +69,7 @@ public class WitherBoss extends Monster implements RangedAttackMob {
@@ -2961,7 +2961,7 @@ index afe43600c4976e01e61d716034a2823d50fb55cb..452fb5473094b713ac456202c3f2f390
if (this.getInvulnerableTicks() > 0) {
int i = this.getInvulnerableTicks() - 1;
this.bossEvent.setProgress(1.0F - i / 220.0F);
@@ -561,11 +686,11 @@ public class WitherBoss extends Monster implements RangedAttackMob {
@@ -563,11 +688,11 @@ public class WitherBoss extends Monster implements RangedAttackMob {
}
public int getAlternativeTarget(int head) {

View File

@@ -0,0 +1,15 @@
--- a/net/minecraft/world/entity/boss/wither/WitherBoss.java
+++ b/net/minecraft/world/entity/boss/wither/WitherBoss.java
@@ -376,8 +_,10 @@
}
}
- if (this.tickCount % 20 == 0) {
- this.heal(1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.REGEN); // CraftBukkit
+ // Purpur start - Customizable wither health and healing
+ if (this.tickCount % level().purpurConfig.witherHealthRegenDelay == 0) {
+ this.heal(level().purpurConfig.witherHealthRegenAmount, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.REGEN); // CraftBukkit
+ // Purpur end - Customizable wither health and healing
}
this.bossEvent.setProgress(this.getHealth() / this.getMaxHealth());

View File

@@ -1865,6 +1865,8 @@ public class PurpurWorldConfig {
public double witherMaxY = 320D;
public double witherMaxHealth = 300.0D;
public double witherScale = 1.0D;
public float witherHealthRegenAmount = 1.0f;
public int witherHealthRegenDelay = 20;
private void witherSettings() {
witherRidable = getBoolean("mobs.wither.ridable", witherRidable);
witherRidableInWater = getBoolean("mobs.wither.ridable-in-water", witherRidableInWater);
@@ -1881,6 +1883,8 @@ public class PurpurWorldConfig {
}
witherMaxHealth = getDouble("mobs.wither.attributes.max_health", witherMaxHealth);
witherScale = Mth.clamp(getDouble("mobs.wither.attributes.scale", witherScale), 0.0625D, 16.0D);
witherHealthRegenAmount = (float) getDouble("mobs.wither.health-regen-amount", witherHealthRegenAmount);
witherHealthRegenDelay = getInt("mobs.wither.health-regen-delay", witherHealthRegenDelay);
}
public boolean witherSkeletonRidable = false;