mirror of
https://github.com/dje4321/TerrafirmaPunk-Tweaks.git
synced 2024-07-01 02:19:08 +00:00
Fix crash with vanilla arrows hitting mobs
Fix crash with vanilla arrows hitting mobs
This commit is contained in:
parent
0a00fdaa8f
commit
7962e92298
|
@ -1,6 +1,6 @@
|
||||||
minecraft_version=1.7.10
|
minecraft_version=1.7.10
|
||||||
forge_version=10.13.4.1558-1.7.10
|
forge_version=10.13.4.1558-1.7.10
|
||||||
tfc_version=0.79.27
|
tfc_version=0.79.27
|
||||||
mod_version=1.08
|
mod_version=1.09
|
||||||
mod_id=TerraFirmaPunkTweaks
|
mod_id=TerraFirmaPunkTweaks
|
||||||
group_name=com.JAWolfe.TerraFirmaPunkTweaks
|
group_name=com.JAWolfe.TerraFirmaPunkTweaks
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,6 +1,11 @@
|
||||||
Changelog
|
Changelog
|
||||||
=================================================
|
=================================================
|
||||||
-------------------------------------------------
|
-------------------------------------------------
|
||||||
|
TFP Tweaks 1.09
|
||||||
|
-------------------------------------------------
|
||||||
|
Bug Fix
|
||||||
|
+Fixed crash from improper casting with mob damage from projectiles
|
||||||
|
-------------------------------------------------
|
||||||
TFP Tweaks 1.08
|
TFP Tweaks 1.08
|
||||||
-------------------------------------------------
|
-------------------------------------------------
|
||||||
New Features
|
New Features
|
||||||
|
|
|
@ -186,64 +186,67 @@ public class PlayerDamageHandler
|
||||||
!event.source.getEntity().getClass().getName().contains("bioxx.tfc") && (!event.source.getEntity().getEntityData().hasKey("Attacking") ||
|
!event.source.getEntity().getClass().getName().contains("bioxx.tfc") && (!event.source.getEntity().getEntityData().hasKey("Attacking") ||
|
||||||
(event.source.getEntity().getEntityData().hasKey("Attacking") && !event.source.getEntity().getEntityData().getBoolean("Attacking"))))
|
(event.source.getEntity().getEntityData().hasKey("Attacking") && !event.source.getEntity().getEntityData().getBoolean("Attacking"))))
|
||||||
{
|
{
|
||||||
EntityLivingBase attacker = (EntityLivingBase)event.source.getEntity();
|
if(event.source.getEntity() instanceof EntityLivingBase && ConfigSettings.VanillaMobDamageScaling)
|
||||||
Entity target = event.entity;
|
|
||||||
|
|
||||||
//Add damage for general damage
|
|
||||||
if (ConfigSettings.VanillaMobDamageScaling && !"indirectMagic".contentEquals(event.source.damageType)
|
|
||||||
&& target.canAttackWithItem())
|
|
||||||
{
|
{
|
||||||
if (!target.hitByEntity(target))
|
EntityLivingBase attacker = (EntityLivingBase)event.source.getEntity();
|
||||||
|
Entity target = event.entity;
|
||||||
|
|
||||||
|
//Add damage for general damage
|
||||||
|
if (ConfigSettings.VanillaMobDamageScaling && !"indirectMagic".contentEquals(event.source.damageType)
|
||||||
|
&& target.canAttackWithItem())
|
||||||
{
|
{
|
||||||
float damageAmount = ConfigSettings.VanillaPvPNonWeaponDamageMultipier;
|
if (!target.hitByEntity(target))
|
||||||
if(attacker.getHeldItem() != null)
|
|
||||||
{
|
{
|
||||||
damageAmount = (float)attacker.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
|
float damageAmount = ConfigSettings.VanillaPvPNonWeaponDamageMultipier;
|
||||||
|
if(attacker.getHeldItem() != null)
|
||||||
if(damageAmount <= 1)
|
{
|
||||||
damageAmount *= ConfigSettings.VanillaPvPNonWeaponDamageMultipier;
|
damageAmount = (float)attacker.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
|
||||||
else
|
|
||||||
damageAmount *= ConfigSettings.VanillaMobDamageMultipier;
|
if(damageAmount <= 1)
|
||||||
}
|
damageAmount *= ConfigSettings.VanillaPvPNonWeaponDamageMultipier;
|
||||||
|
else
|
||||||
if (attacker.isPotionActive(Potion.damageBoost))
|
damageAmount *= ConfigSettings.VanillaMobDamageMultipier;
|
||||||
damageAmount += 3 << attacker.getActivePotionEffect(Potion.damageBoost).getAmplifier();
|
}
|
||||||
|
|
||||||
float enchantmentDamage = 0;
|
if (attacker.isPotionActive(Potion.damageBoost))
|
||||||
|
damageAmount += 3 << attacker.getActivePotionEffect(Potion.damageBoost).getAmplifier();
|
||||||
if (target instanceof EntityLiving)
|
|
||||||
{
|
float enchantmentDamage = 0;
|
||||||
enchantmentDamage = EnchantmentHelper.getEnchantmentModifierLiving(attacker, (EntityLiving) target);
|
|
||||||
}
|
if (target instanceof EntityLiving)
|
||||||
|
{
|
||||||
if (damageAmount > 0 || enchantmentDamage > 0)
|
enchantmentDamage = EnchantmentHelper.getEnchantmentModifierLiving(attacker, (EntityLiving) target);
|
||||||
{
|
}
|
||||||
boolean criticalHit = attacker.fallDistance > 0.0F && !attacker.onGround &&
|
|
||||||
!attacker.isOnLadder() && !attacker.isInWater() &&
|
if (damageAmount > 0 || enchantmentDamage > 0)
|
||||||
!attacker.isPotionActive(Potion.blindness) && attacker.ridingEntity == null &&
|
{
|
||||||
target instanceof EntityLiving;
|
boolean criticalHit = attacker.fallDistance > 0.0F && !attacker.onGround &&
|
||||||
|
!attacker.isOnLadder() && !attacker.isInWater() &&
|
||||||
if (criticalHit && damageAmount > 0)
|
!attacker.isPotionActive(Potion.blindness) && attacker.ridingEntity == null &&
|
||||||
damageAmount += event.entity.worldObj.rand.nextInt((int) (damageAmount / 2 + 2));
|
target instanceof EntityLiving;
|
||||||
|
|
||||||
damageAmount += enchantmentDamage;
|
if (criticalHit && damageAmount > 0)
|
||||||
|
damageAmount += event.entity.worldObj.rand.nextInt((int) (damageAmount / 2 + 2));
|
||||||
//Add "Attacking" tag to attacking entity
|
|
||||||
event.source.getEntity().getEntityData().setBoolean("Attacking", true);
|
damageAmount += enchantmentDamage;
|
||||||
target.attackEntityFrom(event.source, damageAmount);
|
|
||||||
|
//Add "Attacking" tag to attacking entity
|
||||||
|
event.source.getEntity().getEntityData().setBoolean("Attacking", true);
|
||||||
|
target.attackEntityFrom(event.source, damageAmount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//Add damage for indirect magic damage
|
|
||||||
if(ConfigSettings.VanillaMagicScaling && "indirectMagic".contentEquals(event.source.damageType))
|
|
||||||
{
|
|
||||||
event.entity.attackEntityFrom(event.source, ConfigSettings.VanillaPvPNonWeaponDamageMultipier);
|
|
||||||
|
|
||||||
if(event.entity instanceof EntityWitch || event.entity.getClass().toString().contains("EntityWitherWitch"))
|
//Add damage for indirect magic damage
|
||||||
|
if(ConfigSettings.VanillaMagicScaling && "indirectMagic".contentEquals(event.source.damageType))
|
||||||
{
|
{
|
||||||
//Direct hit of a magic bottle kills a witch
|
event.entity.attackEntityFrom(event.source, ConfigSettings.VanillaPvPNonWeaponDamageMultipier);
|
||||||
event.entity.attackEntityFrom(event.source, 100000);
|
|
||||||
|
if(event.entity instanceof EntityWitch || event.entity.getClass().toString().contains("EntityWitherWitch"))
|
||||||
|
{
|
||||||
|
//Direct hit of a magic bottle kills a witch
|
||||||
|
event.entity.attackEntityFrom(event.source, 100000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user