diff --git a/build.prop b/build.prop index 13cb150..f09da9a 100644 --- a/build.prop +++ b/build.prop @@ -1,6 +1,6 @@ minecraft_version=1.7.10 forge_version=10.13.4.1558-1.7.10 tfc_version=0.79.27 -mod_version=1.08 +mod_version=1.09 mod_id=TerraFirmaPunkTweaks group_name=com.JAWolfe.TerraFirmaPunkTweaks \ No newline at end of file diff --git a/builds/TerraFirmaPunkTweaks-1.7.10-1.08.jar b/builds/TerraFirmaPunkTweaks-1.7.10-1.09.jar similarity index 86% rename from builds/TerraFirmaPunkTweaks-1.7.10-1.08.jar rename to builds/TerraFirmaPunkTweaks-1.7.10-1.09.jar index 3f5cc33..49bf736 100644 Binary files a/builds/TerraFirmaPunkTweaks-1.7.10-1.08.jar and b/builds/TerraFirmaPunkTweaks-1.7.10-1.09.jar differ diff --git a/builds/TerraFirmaPunkTweaks-1.7.10-deobf-1.08.jar b/builds/TerraFirmaPunkTweaks-1.7.10-deobf-1.09.jar similarity index 81% rename from builds/TerraFirmaPunkTweaks-1.7.10-deobf-1.08.jar rename to builds/TerraFirmaPunkTweaks-1.7.10-deobf-1.09.jar index 03a7d26..953f1af 100644 Binary files a/builds/TerraFirmaPunkTweaks-1.7.10-deobf-1.08.jar and b/builds/TerraFirmaPunkTweaks-1.7.10-deobf-1.09.jar differ diff --git a/builds/TerraFirmaPunkTweaks-1.7.10-src-1.08.jar b/builds/TerraFirmaPunkTweaks-1.7.10-src-1.09.jar similarity index 84% rename from builds/TerraFirmaPunkTweaks-1.7.10-src-1.08.jar rename to builds/TerraFirmaPunkTweaks-1.7.10-src-1.09.jar index bfbd97d..4e53dcc 100644 Binary files a/builds/TerraFirmaPunkTweaks-1.7.10-src-1.08.jar and b/builds/TerraFirmaPunkTweaks-1.7.10-src-1.09.jar differ diff --git a/changelog.txt b/changelog.txt index 87d0b55..f25240e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,11 @@ Changelog ================================================= ------------------------------------------------- +TFP Tweaks 1.09 +------------------------------------------------- +Bug Fix ++Fixed crash from improper casting with mob damage from projectiles +------------------------------------------------- TFP Tweaks 1.08 ------------------------------------------------- New Features diff --git a/src/main/java/com/JAWolfe/terrafirmapunktweaks/handlers/PlayerDamageHandler.java b/src/main/java/com/JAWolfe/terrafirmapunktweaks/handlers/PlayerDamageHandler.java index 3acf9c1..255a4ed 100644 --- a/src/main/java/com/JAWolfe/terrafirmapunktweaks/handlers/PlayerDamageHandler.java +++ b/src/main/java/com/JAWolfe/terrafirmapunktweaks/handlers/PlayerDamageHandler.java @@ -186,64 +186,67 @@ public class PlayerDamageHandler !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")))) { - 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()) + if(event.source.getEntity() instanceof EntityLivingBase && ConfigSettings.VanillaMobDamageScaling) { - 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(attacker.getHeldItem() != null) + if (!target.hitByEntity(target)) { - damageAmount = (float)attacker.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue(); - - if(damageAmount <= 1) - damageAmount *= ConfigSettings.VanillaPvPNonWeaponDamageMultipier; - else - damageAmount *= ConfigSettings.VanillaMobDamageMultipier; - } - - if (attacker.isPotionActive(Potion.damageBoost)) - damageAmount += 3 << attacker.getActivePotionEffect(Potion.damageBoost).getAmplifier(); - - float enchantmentDamage = 0; - - if (target instanceof EntityLiving) - { - enchantmentDamage = EnchantmentHelper.getEnchantmentModifierLiving(attacker, (EntityLiving) target); - } - - if (damageAmount > 0 || enchantmentDamage > 0) - { - boolean criticalHit = attacker.fallDistance > 0.0F && !attacker.onGround && - !attacker.isOnLadder() && !attacker.isInWater() && - !attacker.isPotionActive(Potion.blindness) && attacker.ridingEntity == null && - target instanceof EntityLiving; - - if (criticalHit && damageAmount > 0) - damageAmount += event.entity.worldObj.rand.nextInt((int) (damageAmount / 2 + 2)); - - damageAmount += enchantmentDamage; - - //Add "Attacking" tag to attacking entity - event.source.getEntity().getEntityData().setBoolean("Attacking", true); - target.attackEntityFrom(event.source, damageAmount); + float damageAmount = ConfigSettings.VanillaPvPNonWeaponDamageMultipier; + if(attacker.getHeldItem() != null) + { + damageAmount = (float)attacker.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue(); + + if(damageAmount <= 1) + damageAmount *= ConfigSettings.VanillaPvPNonWeaponDamageMultipier; + else + damageAmount *= ConfigSettings.VanillaMobDamageMultipier; + } + + if (attacker.isPotionActive(Potion.damageBoost)) + damageAmount += 3 << attacker.getActivePotionEffect(Potion.damageBoost).getAmplifier(); + + float enchantmentDamage = 0; + + if (target instanceof EntityLiving) + { + enchantmentDamage = EnchantmentHelper.getEnchantmentModifierLiving(attacker, (EntityLiving) target); + } + + if (damageAmount > 0 || enchantmentDamage > 0) + { + boolean criticalHit = attacker.fallDistance > 0.0F && !attacker.onGround && + !attacker.isOnLadder() && !attacker.isInWater() && + !attacker.isPotionActive(Potion.blindness) && attacker.ridingEntity == null && + target instanceof EntityLiving; + + if (criticalHit && damageAmount > 0) + damageAmount += event.entity.worldObj.rand.nextInt((int) (damageAmount / 2 + 2)); + + damageAmount += enchantmentDamage; + + //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, 100000); + event.entity.attackEntityFrom(event.source, ConfigSettings.VanillaPvPNonWeaponDamageMultipier); + + 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); + } } } }