Ridable wither! :O

This commit is contained in:
William Blake Galbreath
2020-08-21 08:40:35 -05:00
parent 2b204722ca
commit 5cd346b2b5
2 changed files with 347 additions and 33 deletions

View File

@@ -6,26 +6,23 @@ 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 29bb74e51e..d847c03c0c 100644
index 6c48c9659d..624821be11 100644
--- a/src/main/java/net/minecraft/server/EntityWither.java
+++ b/src/main/java/net/minecraft/server/EntityWither.java
@@ -41,6 +41,15 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
this.f = 50;
@@ -144,6 +144,12 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
skull.setPositionRaw(headX, headY, headZ);
world.addEntity(skull);
}
+ // Purpur start
+ @Override
+
+ public void initAttributes(World world) {
+ if (world != null) {
+ this.getAttributeInstance(GenericAttributes.MAX_HEALTH).setValue(world.purpurConfig.witherMaxHealth);
+ }
+ }
+ // Purpur end
+
// Purpur end
@Override
protected void initPathfinder() {
this.goalSelector.a(0, new EntityWither.a());
@@ -230,7 +239,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
@@ -347,7 +353,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
this.setInvul(i);
if (this.ticksLived % 10 == 0) {
@@ -34,7 +31,7 @@ index 29bb74e51e..d847c03c0c 100644
}
} else {
@@ -339,9 +348,11 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
@@ -456,8 +462,10 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
}
}
@@ -43,12 +40,11 @@ index 29bb74e51e..d847c03c0c 100644
+ // Purpur start - customizable heal rate and amount
+ if (this.ticksLived % world.purpurConfig.witherHealthRegenDelay == 0) {
+ this.heal(world.purpurConfig.witherHealthRegenAmount, EntityRegainHealthEvent.RegainReason.REGEN); // CraftBukkit
+ // Purpur end
}
+ // Purpur end
//this.bossBattle.setProgress(this.getHealth() / this.getMaxHealth()); // Paper - Moved down
}
@@ -355,6 +366,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
@@ -472,6 +480,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
public void beginSpawnSequence() {
this.setInvul(220);
this.setHealth(this.getMaxHealth() / 3.0F);
@@ -57,22 +53,23 @@ index 29bb74e51e..d847c03c0c 100644
@Override
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index efc4b3a3a0..bb3f0097d5 100644
index 66ac267f00..c7ccc896a0 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -884,6 +884,15 @@ public class PurpurWorldConfig {
witchRidableInWater = getBoolean("mobs.witch.ridable-in-water", witchRidableInWater);
}
@@ -887,10 +887,16 @@ public class PurpurWorldConfig {
public boolean witherRidable = false;
public boolean witherRidableInWater = false;
public double witherMaxY = 256D;
+ public double witherMaxHealth = 300.0D;
+ public float witherHealthRegenAmount = 1.0f;
+ public int witherHealthRegenDelay = 20;
+ private void witherSettings() {
private void witherSettings() {
witherRidable = getBoolean("mobs.wither.ridable", witherRidable);
witherRidableInWater = getBoolean("mobs.wither.ridable-in-water", witherRidableInWater);
witherMaxY = getDouble("mobs.wither.ridable-max-y", witherMaxY);
+ witherMaxHealth = getDouble("mobs.wither.max-health", witherMaxHealth);
+ witherHealthRegenAmount = (float) getDouble("mobs.wither.health-regen-amount", witherHealthRegenAmount);
+ witherHealthRegenDelay = getInt("mobs.wither.health-regen-delay", witherHealthRegenDelay);
+ }
+
}
public boolean witherSkeletonRidable = false;
public boolean witherSkeletonRidableInWater = false;
public boolean witherSkeletonTakesWitherDamage = false;