add default silverfish movement speed & attack damage attributes

This commit is contained in:
granny
2024-06-21 00:26:19 -07:00
parent b5f1c487e7
commit c0f5e78dc2
41 changed files with 268 additions and 262 deletions

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Configurable entity base attributes
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 67aa0563c33bc9a98facfff6bf5a1a8ace483d99..4c7439645974fd20f9f23196c5fbdce6ce324d13 100644
index f332458dbc26bb0e77ca9b7446f4ae800c359d13..6ff9e8bb038e7e1b89796a2e9d271371052ccf22 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -168,7 +168,7 @@ import org.bukkit.plugin.PluginManager;
@@ -34,7 +34,7 @@ index aa76a24421cdb3908a3544d92eb3d1e3c2ebedc4..8211c152e6f4232e82e452b08047e457
protected ParticleOptions getInkParticle() {
return ParticleTypes.GLOW_SQUID_INK;
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 6b5d09b34c9fe88548a14e64e9aa42841e9031f5..8bad6672c689c7bc65e5941887b3826ad99e36bb 100644
index 661db9eb343b32f97d6e7ccb93e56e24213b6367..305fb567e5407bbdc9fbc30bf8ce2839e8fb15c9 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -314,6 +314,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1174,16 +1174,18 @@ index f36ccb36753d1b1a6c7706729e598078f4467644..123f8418544468d5c8d0d280f7dd44eb
protected void registerGoals() {
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur
diff --git a/src/main/java/net/minecraft/world/entity/monster/Silverfish.java b/src/main/java/net/minecraft/world/entity/monster/Silverfish.java
index 97cab38a47e302f40ca69ef4eb8f7dcb11eccf35..75f82922260b2c0666021e7ed42dfde401e1a9d6 100644
index 97cab38a47e302f40ca69ef4eb8f7dcb11eccf35..9d5d71135b00eb0ab1b1dfaf7925e13b8a44d22c 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Silverfish.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Silverfish.java
@@ -60,6 +60,11 @@ public class Silverfish extends Monster {
@@ -60,6 +60,13 @@ public class Silverfish extends Monster {
}
// Purpur end
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.silverfishMaxHealth);
+ this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(this.level().purpurConfig.silverfishMovementSpeed);
+ this.getAttribute(Attributes.ATTACK_DAMAGE).setBaseValue(this.level().purpurConfig.silverfishAttackDamage);
+ }
+
@Override
@@ -1539,7 +1541,7 @@ index d514faecb9e6b244aa043383fa072316da939518..a4ca761f6e8e6e8f86fc20ce5e3dcf92
protected void registerGoals() {
this.goalSelector.addGoal(0, new FloatGoal(this));
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index bb64706d04fb25dcd564799c26fad231086ff827..767d977cf47b0c7d94c248091f3ce98d6383ae04 100644
index bb64706d04fb25dcd564799c26fad231086ff827..eb66b0debaf18dccb74503ab5b700759b65dc725 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -113,116 +113,211 @@ public class PurpurWorldConfig {
@@ -2244,7 +2246,7 @@ index bb64706d04fb25dcd564799c26fad231086ff827..767d977cf47b0c7d94c248091f3ce98d
private void phantomSettings() {
phantomRidable = getBoolean("mobs.phantom.ridable", phantomRidable);
phantomRidableInWater = getBoolean("mobs.phantom.ridable-in-water", phantomRidableInWater);
@@ -479,191 +828,363 @@ public class PurpurWorldConfig {
@@ -479,191 +828,367 @@ public class PurpurWorldConfig {
phantomFlameDamage = (float) getDouble("mobs.phantom.flames.damage", phantomFlameDamage);
phantomFlameFireTime = getInt("mobs.phantom.flames.fire-time", phantomFlameFireTime);
phantomAllowGriefing = getBoolean("mobs.phantom.allow-griefing", phantomAllowGriefing);
@@ -2439,6 +2441,8 @@ index bb64706d04fb25dcd564799c26fad231086ff827..767d977cf47b0c7d94c248091f3ce98d
public boolean silverfishRidableInWater = true;
public boolean silverfishControllable = true;
+ public double silverfishMaxHealth = 8.0D;
+ public double silverfishMovementSpeed = 0.25D;
+ public double silverfishAttackDamage = 1.0D;
private void silverfishSettings() {
silverfishRidable = getBoolean("mobs.silverfish.ridable", silverfishRidable);
silverfishRidableInWater = getBoolean("mobs.silverfish.ridable-in-water", silverfishRidableInWater);
@@ -2449,6 +2453,8 @@ index bb64706d04fb25dcd564799c26fad231086ff827..767d977cf47b0c7d94c248091f3ce98d
+ set("mobs.silverfish.attributes.max_health", oldValue);
+ }
+ silverfishMaxHealth = getDouble("mobs.silverfish.attributes.max_health", silverfishMaxHealth);
+ silverfishMovementSpeed = getDouble("mobs.silverfish.attributes.movement_speed", silverfishMovementSpeed);
+ silverfishAttackDamage = getDouble("mobs.silverfish.attributes.attack_damage", silverfishAttackDamage);
}
public boolean skeletonRidable = false;
@@ -2608,7 +2614,7 @@ index bb64706d04fb25dcd564799c26fad231086ff827..767d977cf47b0c7d94c248091f3ce98d
}
public boolean tadpoleRidable = false;
@@ -678,64 +1199,125 @@ public class PurpurWorldConfig {
@@ -678,64 +1203,125 @@ public class PurpurWorldConfig {
public boolean traderLlamaRidable = false;
public boolean traderLlamaRidableInWater = false;
public boolean traderLlamaControllable = true;
@@ -2734,7 +2740,7 @@ index bb64706d04fb25dcd564799c26fad231086ff827..767d977cf47b0c7d94c248091f3ce98d
}
public boolean wardenRidable = false;
@@ -750,83 +1332,167 @@ public class PurpurWorldConfig {
@@ -750,83 +1336,167 @@ public class PurpurWorldConfig {
public boolean witchRidable = false;
public boolean witchRidableInWater = true;
public boolean witchControllable = true;