[ci-skip] More attributes work

This commit is contained in:
BillyGalbreath
2020-12-23 09:47:27 -06:00
parent 19ec1c311f
commit 7ad2c5d503
24 changed files with 432 additions and 676 deletions

View File

@@ -6,24 +6,22 @@ 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/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java
index f68cf834aa65cc4bbb1eb9901586395d41770955..e8cc3af606f4874b6f32369f7f211f480670868b 100644
index f68cf834aa65cc4bbb1eb9901586395d41770955..71b6fc480617f040029b2201f24d05affeb90b70 100644
--- a/src/main/java/net/minecraft/server/EntityWither.java
+++ b/src/main/java/net/minecraft/server/EntityWither.java
@@ -145,6 +145,13 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
@@ -145,6 +145,11 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
skull.setPositionRaw(headX, headY, headZ);
world.addEntity(skull);
}
+
+ public void initAttributes(World world) {
+ if (world != null) {
+ this.getAttributeInstance(GenericAttributes.MAX_HEALTH).setValue(world.purpurConfig.witherMaxHealth);
+ //setHealth(getMaxHealth()); // do NOT do this for wither! health grows when first spawned
+ }
+ @Override
+ public void initAttributes() {
+ this.getAttributeInstance(GenericAttributes.MAX_HEALTH).setValue(world.purpurConfig.witherMaxHealth);
+ }
// Purpur end
@Override
@@ -348,7 +355,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
@@ -348,7 +353,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
this.setInvul(i);
if (this.ticksLived % 10 == 0) {
@@ -32,7 +30,7 @@ index f68cf834aa65cc4bbb1eb9901586395d41770955..e8cc3af606f4874b6f32369f7f211f48
}
} else {
@@ -457,8 +464,10 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
@@ -457,8 +462,10 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
}
}
@@ -45,14 +43,6 @@ index f68cf834aa65cc4bbb1eb9901586395d41770955..e8cc3af606f4874b6f32369f7f211f48
}
//this.bossBattle.setProgress(this.getHealth() / this.getMaxHealth()); // Paper - Moved down
@@ -473,6 +482,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
public void beginSpawnSequence() {
this.setInvul(220);
this.setHealth(this.getMaxHealth() / 3.0F);
+ initAttributes(this.world); // Purpur - building the wither with soul_sand + wither_skeleton_skulls does not call prepare, so we need to call this manually
}
@Override
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 1025b5daef29da23f1a80c1c0a1ef0eeee18384e..0f2e0e779198765a7dfa2d4c56b8b2ff8fb08f96 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java