Mod Friendly Piercing (Rapier, Arrow & Bolts) (#60)

* Mod Friendly piercing

Piercing damage converted to bonus damage equivalent to victim's armor protection (capped at diamond armor).

This prevents rapiers from bypassing immunities.

* Run SpotlessApply

* Delete commented out code
This commit is contained in:
DrParadox7 authored and GitHub committed 2022-12-27 09:11:45 +01:00
1 parent 450154c15d
commit 7ff7f25f73
4 files changed
+11 -3

No files matched your search

@@ -112,7 +112,11 @@ public class AbilityHelper {
}
boolean causedDamage = false;
boolean isAlive = entity.isEntityAlive();
if (tool.pierceArmor() && !broken) {
if (tool.pierceArmor() && !broken && entity instanceof EntityLivingBase) {
int armorValue = Math.min(20, ((EntityLivingBase) entity).getTotalArmorValue());
damage = (int) (damage / (1 - (0.04 * armorValue)));
if (player instanceof EntityPlayer)
causedDamage =
entity.attackEntityFrom(causePlayerPiercingDamage((EntityPlayer) player), damage);