|
|
|
@ -39,35 +39,35 @@ public class CinderEventHandler implements IFuelHandler {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@SubscribeEvent
|
|
|
|
@SubscribeEvent
|
|
|
|
public void onLivingAttack(LivingAttackEvent event) {
|
|
|
|
public void onLivingHurt(LivingHurtEvent event) {
|
|
|
|
EntityLivingBase entity = event.entityLiving;;
|
|
|
|
EntityLivingBase entity = event.entityLiving;
|
|
|
|
Entity sourceEntity = event.source.getEntity();
|
|
|
|
EntityLivingBase attacker = event.source.getEntity() instanceof EntityLivingBase ? (EntityLivingBase) event.source.getEntity() : null;
|
|
|
|
World world = entity.worldObj;
|
|
|
|
World world = entity.worldObj;
|
|
|
|
|
|
|
|
|
|
|
|
// Negative Arrow Protection Handle
|
|
|
|
// Negative Arrow Protection Handler
|
|
|
|
if (event.source.isProjectile() && entity instanceof EntityPlayerMP) {
|
|
|
|
if (event.source.isProjectile() && entity instanceof EntityPlayerMP) {
|
|
|
|
EntityPlayerMP player = (EntityPlayerMP) entity;
|
|
|
|
EntityPlayerMP player = (EntityPlayerMP) entity;
|
|
|
|
player.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "DEBUG: Original Damage: " + (event.ammount)));
|
|
|
|
float totalAdditionalDamage = 0.0f;
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 4; i++) {
|
|
|
|
for (int i = 0; i < 4; i++) {
|
|
|
|
ItemStack armor = entity.getEquipmentInSlot(i + 1);
|
|
|
|
ItemStack armor = entity.getEquipmentInSlot(i + 1);
|
|
|
|
|
|
|
|
|
|
|
|
if (armor != null) {
|
|
|
|
if (armor != null) {
|
|
|
|
LOTREnchantment enchantment = LOTREnchantment.getEnchantmentByName("protectRangedWeak1");
|
|
|
|
LOTREnchantment enchantment = LOTREnchantment.getEnchantmentByName("protectRangedWeak1");
|
|
|
|
if (LOTREnchantmentHelper.hasEnchant(armor, enchantment)) {
|
|
|
|
if (LOTREnchantmentHelper.hasEnchant(armor, enchantment)) {
|
|
|
|
float additionalDamage = 1.6f; //60% more damage
|
|
|
|
float level = enchantment.getValueModifier();
|
|
|
|
// event.setCanceled(true); //Disabled to see if this was the source of spam, it wasnt
|
|
|
|
if (level > 0) {
|
|
|
|
entity.attackEntityFrom(event.source, event.ammount * additionalDamage);
|
|
|
|
totalAdditionalDamage += 1.6f; // 20% more damage per level
|
|
|
|
player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "DEBUG: damage received, total damage: " + (event.ammount + additionalDamage)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Apply the total additional damage to the event amount
|
|
|
|
|
|
|
|
if (totalAdditionalDamage > 0) {
|
|
|
|
|
|
|
|
event.ammount += totalAdditionalDamage;
|
|
|
|
|
|
|
|
player.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "DEBUG: total damage received: " + event.ammount));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@SubscribeEvent
|
|
|
|
|
|
|
|
public void onLivingHurt(LivingHurtEvent event) {
|
|
|
|
|
|
|
|
EntityLivingBase entity = event.entityLiving;
|
|
|
|
|
|
|
|
EntityLivingBase attacker = event.source.getEntity() instanceof EntityLivingBase ? (EntityLivingBase) event.source.getEntity() : null;
|
|
|
|
|
|
|
|
World world = entity.worldObj;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Broken Halo Event handler
|
|
|
|
// Broken Halo Event handler
|
|
|
|
if (attacker != null && event.source.getSourceOfDamage() == attacker) {
|
|
|
|
if (attacker != null && event.source.getSourceOfDamage() == attacker) {
|
|
|
|
|