mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-20 09:57:43 +01:00
Touch up wither health patch
This commit is contained in:
@@ -6,22 +6,27 @@ 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.
|
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
|
diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java
|
||||||
index 1511212cbf..78a5449d1c 100644
|
index 1511212cbf..81b3b9fbc5 100644
|
||||||
--- a/src/main/java/net/minecraft/server/EntityWither.java
|
--- a/src/main/java/net/minecraft/server/EntityWither.java
|
||||||
+++ b/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 {
|
@@ -41,6 +41,16 @@ 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;
|
this.f = 50;
|
||||||
@@ -230,7 +235,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
|
}
|
||||||
|
|
||||||
|
+ // Purpur start
|
||||||
|
+ @Override
|
||||||
|
+ public void initAttributes(World world) {
|
||||||
|
+ if (world != null) {
|
||||||
|
+ this.getAttributeInstance(GenericAttributes.MAX_HEALTH).setValue(world.purpurConfig.witherMaxHealth);
|
||||||
|
+ setHealth(getMaxHealth());
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ // Purpur end
|
||||||
|
+
|
||||||
|
@Override
|
||||||
|
protected void initPathfinder() {
|
||||||
|
this.goalSelector.a(0, new EntityWither.a());
|
||||||
|
@@ -230,7 +240,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
|
||||||
|
|
||||||
this.setInvul(i);
|
this.setInvul(i);
|
||||||
if (this.ticksLived % 10 == 0) {
|
if (this.ticksLived % 10 == 0) {
|
||||||
@@ -30,37 +35,37 @@ index 1511212cbf..78a5449d1c 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -339,9 +344,11 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
|
@@ -339,9 +349,11 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- if (this.ticksLived % 20 == 0) {
|
- if (this.ticksLived % 20 == 0) {
|
||||||
- this.heal(1.0F, EntityRegainHealthEvent.RegainReason.REGEN); // CraftBukkit
|
- this.heal(1.0F, EntityRegainHealthEvent.RegainReason.REGEN); // CraftBukkit
|
||||||
+ // Purpur start - customizable heal rate and amount
|
+ // Purpur start - customizable heal rate and amount
|
||||||
+ if (this.ticksLived % world.purpurConfig.witherBossHealthRegenDelay == 0) {
|
+ if (this.ticksLived % world.purpurConfig.witherHealthRegenDelay == 0) {
|
||||||
+ this.heal(world.purpurConfig.witherBossHealthRegenAmount, EntityRegainHealthEvent.RegainReason.REGEN); // CraftBukkit
|
+ this.heal(world.purpurConfig.witherHealthRegenAmount, EntityRegainHealthEvent.RegainReason.REGEN); // CraftBukkit
|
||||||
}
|
}
|
||||||
+ // Purpur end
|
+ // Purpur end
|
||||||
|
|
||||||
this.bossBattle.setProgress(this.getHealth() / this.getMaxHealth());
|
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
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||||
index d19c6d13cf..aaf1735e66 100644
|
index d19c6d13cf..2b05ae68bc 100644
|
||||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||||
@@ -887,6 +887,15 @@ public class PurpurWorldConfig {
|
@@ -878,6 +878,15 @@ public class PurpurWorldConfig {
|
||||||
witherSkeletonTakesWitherDamage = getBoolean("mobs.wither_skeleton.takes-wither-damage", witherSkeletonTakesWitherDamage);
|
witchRidableInWater = getBoolean("mobs.witch.ridable-in-water", witchRidableInWater);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ public double witherBossMaxHealth = 300.0D;
|
+ public double witherMaxHealth = 300.0D;
|
||||||
+ public float witherBossHealthRegenAmount = 1.0f;
|
+ public float witherHealthRegenAmount = 1.0f;
|
||||||
+ public int witherBossHealthRegenDelay = 20;
|
+ public int witherHealthRegenDelay = 20;
|
||||||
+ private void witherSettings() {
|
+ private void witherSettings() {
|
||||||
+ witherBossMaxHealth = getDouble("mobs.wither_boss.max-health", witherBossMaxHealth);
|
+ witherMaxHealth = getDouble("mobs.wither.max-health", witherMaxHealth);
|
||||||
+ witherBossHealthRegenAmount = (float) getDouble("mobs.wither_boss.health-regen-amount", witherBossHealthRegenAmount);
|
+ witherHealthRegenAmount = (float) getDouble("mobs.wither.health-regen-amount", witherHealthRegenAmount);
|
||||||
+ witherBossHealthRegenDelay = getInt("mobs.wither_boss.health-regen-delay", witherBossHealthRegenDelay);
|
+ witherHealthRegenDelay = getInt("mobs.wither.health-regen-delay", witherHealthRegenDelay);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
public boolean wolfRidable = false;
|
public boolean witherSkeletonRidable = false;
|
||||||
public boolean wolfRidableInWater = false;
|
public boolean witherSkeletonRidableInWater = false;
|
||||||
private void wolfSettings() {
|
public boolean witherSkeletonTakesWitherDamage = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user