use of micdoodle8.mods.galacticraft.api.item.IArmorCorrosionResistant in project Galacticraft by micdoodle8.
the class GCPlayerHandler method checkShield.
protected void checkShield(EntityPlayerMP playerMP, GCPlayerStats playerStats) {
if (playerMP.ticksExisted % 20 == 0 && playerMP.world.provider instanceof IGalacticraftWorldProvider) {
if (((IGalacticraftWorldProvider) playerMP.world.provider).shouldCorrodeArmor()) {
ItemStack shieldController = playerStats.getExtendedInventory().getStackInSlot(10);
boolean valid = false;
if (!shieldController.isEmpty()) {
int gearID = GalacticraftRegistry.findMatchingGearID(shieldController, EnumExtendedInventorySlot.SHIELD_CONTROLLER);
if (gearID != -1) {
valid = true;
}
}
if (!valid) {
for (ItemStack armor : playerMP.getArmorInventoryList()) {
if (!armor.isEmpty() && armor.getItem() instanceof ItemArmor && !(armor.getItem() instanceof IArmorCorrosionResistant)) {
armor.damageItem(1, playerMP);
}
}
}
}
}
}
Aggregations