mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
Add attribute clamping and armor limit config
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
--- a/net/minecraft/world/damagesource/CombatRules.java
|
||||
+++ b/net/minecraft/world/damagesource/CombatRules.java
|
||||
@@ -15,7 +_,7 @@
|
||||
|
||||
public static float getDamageAfterAbsorb(LivingEntity entity, float damage, DamageSource damageSource, float armorValue, float armorToughness) {
|
||||
float f = 2.0F + armorToughness / 4.0F;
|
||||
- float f1 = Mth.clamp(armorValue - damage / f, armorValue * 0.2F, 20.0F);
|
||||
+ float f1 = Mth.clamp(armorValue - damage / f, armorValue * 0.2F, org.purpurmc.purpur.PurpurConfig.limitArmor ? 20F : Float.MAX_VALUE); // Purpur - Add attribute clamping and armor limit config
|
||||
float f2 = f1 / 25.0F;
|
||||
ItemStack weaponItem = damageSource.getWeaponItem();
|
||||
float f3;
|
||||
@@ -30,7 +_,7 @@
|
||||
}
|
||||
|
||||
public static float getDamageAfterMagicAbsorb(float damage, float enchantModifiers) {
|
||||
- float f = Mth.clamp(enchantModifiers, 0.0F, 20.0F);
|
||||
+ float f = Mth.clamp(enchantModifiers, 0.0F, org.purpurmc.purpur.PurpurConfig.limitArmor ? 20F : Float.MAX_VALUE); // Purpur - Add attribute clamping and armor limit config
|
||||
return damage * (1.0F - f / 25.0F);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
--- a/net/minecraft/world/entity/ai/attributes/RangedAttribute.java
|
||||
+++ b/net/minecraft/world/entity/ai/attributes/RangedAttribute.java
|
||||
@@ -29,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public double sanitizeValue(double value) {
|
||||
+ if (!org.purpurmc.purpur.PurpurConfig.clampAttributes) return Double.isNaN(value) ? this.minValue : value; // Purpur - Add attribute clamping and armor limit config
|
||||
return Double.isNaN(value) ? this.minValue : Mth.clamp(value, this.minValue, this.maxValue);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user