mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-25 06:24:37 +00:00
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:
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);
|
||||
|
||||
@@ -6,7 +6,6 @@ import net.minecraft.util.EntityDamageSourceIndirect;
|
||||
public class PiercingArrowDamage extends EntityDamageSourceIndirect {
|
||||
public PiercingArrowDamage(String p_i1568_1_, Entity p_i1568_2_, Entity p_i1568_3_) {
|
||||
super(p_i1568_1_, p_i1568_2_, p_i1568_3_);
|
||||
this.setDamageBypassesArmor();
|
||||
this.setProjectile();
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,5 @@ import net.minecraft.util.EntityDamageSource;
|
||||
public class PiercingEntityDamage extends EntityDamageSource {
|
||||
public PiercingEntityDamage(String str, Entity entity) {
|
||||
super(str, entity);
|
||||
this.setDamageBypassesArmor();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package tconstruct.weaponry.entity;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -95,6 +96,11 @@ public class ArrowEntity extends ProjectileBase {
|
||||
|
||||
// deal armor piercing damage
|
||||
if (shift > 0) {
|
||||
|
||||
if (entityHit instanceof EntityLivingBase) {
|
||||
int armorValue = Math.min(20, ((EntityLivingBase) entityHit).getTotalArmorValue());
|
||||
shift = (int) (shift / (1 - (0.04 * armorValue)));
|
||||
}
|
||||
DamageSource damagesource;
|
||||
if (this.shootingEntity == null) damagesource = new PiercingArrowDamage("arrow", this, this);
|
||||
else damagesource = new PiercingArrowDamage("arrow", this, this.shootingEntity);
|
||||
|
||||
Reference in new issue
Block a user