Всем привет. Сделал проверку на броню, которая надета на игрока и в зависимости от этого я назначаю урон который будет проходить при определенном воздействии, но не в этом суть. Когда я надеваю броню, то все работает, урон проходит, а если я без брони то крашит. В чем может быть проблема?
Код:
if(ep.inventory.armorInventory[2].getItem() instanceof ItemArmorBase && ep.inventory.armorInventory[2] != null)
{
ep.attackEntityFrom(DamageSource.wither, 8.0F);
}
else if(ep.inventory.armorInventory[2].getItem() instanceof ItemArmor1 && ep.inventory.armorInventory[2].getItem() instanceof ItemArmor6 && ep.inventory.armorInventory[2] != null)
{
ep.attackEntityFrom(DamageSource.wither, 6.0F);
}
else if(ep.inventory.armorInventory[2].getItem() instanceof ItemArmor2 && ep.inventory.armorInventory[2] != null)
{
ep.attackEntityFrom(DamageSource.wither, 7.0F);
}
else if(ep.inventory.armorInventory[2].getItem() instanceof ItemArmor3 && ep.inventory.armorInventory[2] != null)
{
ep.attackEntityFrom(DamageSource.wither, 4.0F);
}
else if(ep.inventory.armorInventory[2].getItem() instanceof ItemArmor4 && ep.inventory.armorInventory[2] != null)
{
ep.attackEntityFrom(DamageSource.wither, 3.0F);
}
else if(ep.inventory.armorInventory[2].getItem() instanceof ItemArmor5 && ep.inventory.armorInventory[2] != null)
{
ep.attackEntityFrom(DamageSource.wither, 9.0F);
}
else {
ep.attackEntityFrom(DamageSource.wither, 12.0F);
}