Search in sources :

Example 1 with IArmorCorrosionResistant

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);
                    }
                }
            }
        }
    }
}
Also used : IGalacticraftWorldProvider(micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider) ItemArmor(net.minecraft.item.ItemArmor) ItemStack(net.minecraft.item.ItemStack) TargetPoint(net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint) Footprint(micdoodle8.mods.galacticraft.core.wrappers.Footprint) IArmorCorrosionResistant(micdoodle8.mods.galacticraft.api.item.IArmorCorrosionResistant)

Aggregations

IArmorCorrosionResistant (micdoodle8.mods.galacticraft.api.item.IArmorCorrosionResistant)1 IGalacticraftWorldProvider (micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider)1 Footprint (micdoodle8.mods.galacticraft.core.wrappers.Footprint)1 ItemArmor (net.minecraft.item.ItemArmor)1 ItemStack (net.minecraft.item.ItemStack)1 TargetPoint (net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint)1