Search in sources :

Example 6 with ItemLivingArmour

use of WayofTime.bloodmagic.item.armour.ItemLivingArmour in project BloodMagic by WayofTime.

the class ItemLivingArmourPointsUpgrade method onItemUseFinish.

@Override
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityLivingBase entityLiving) {
    if (!(entityLiving instanceof EntityPlayer))
        return super.onItemUseFinish(stack, worldIn, entityLiving);
    EntityPlayer player = (EntityPlayer) entityLiving;
    if (!player.capabilities.isCreativeMode)
        stack.shrink(1);
    if (!worldIn.isRemote) {
        player.addPotionEffect(new PotionEffect(MobEffects.WITHER, 300, 5));
        player.addPotionEffect(new PotionEffect(MobEffects.POISON, 300, 5));
        player.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 400, 1));
        if (LivingArmour.hasFullSet(player)) {
            ItemStack chestStack = Iterables.toArray(player.getArmorInventoryList(), ItemStack.class)[2];
            LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
            if (armour != null) {
                if (armour.maxUpgradePoints < 200) {
                    armour.maxUpgradePoints = 200;
                    ((ItemLivingArmour) chestStack.getItem()).setLivingArmour(chestStack, armour, true);
                    ItemLivingArmour.setLivingArmour(chestStack, armour);
                }
            }
        }
    }
    return stack;
}
Also used : ItemLivingArmour(WayofTime.bloodmagic.item.armour.ItemLivingArmour) LivingArmour(WayofTime.bloodmagic.livingArmour.LivingArmour) ItemLivingArmour(WayofTime.bloodmagic.item.armour.ItemLivingArmour) PotionEffect(net.minecraft.potion.PotionEffect) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ItemStack(net.minecraft.item.ItemStack)

Aggregations

ItemLivingArmour (WayofTime.bloodmagic.item.armour.ItemLivingArmour)6 LivingArmour (WayofTime.bloodmagic.livingArmour.LivingArmour)5 ItemStack (net.minecraft.item.ItemStack)5 EntityPlayer (net.minecraft.entity.player.EntityPlayer)4 LivingArmourUpgrade (WayofTime.bloodmagic.livingArmour.LivingArmourUpgrade)2 EntityLightningBolt (net.minecraft.entity.effect.EntityLightningBolt)2 BlockPos (net.minecraft.util.math.BlockPos)2 World (net.minecraft.world.World)2 BloodMagic (WayofTime.bloodmagic.BloodMagic)1 IBMBlock (WayofTime.bloodmagic.block.IBMBlock)1 IMeshProvider (WayofTime.bloodmagic.client.IMeshProvider)1 IVariantProvider (WayofTime.bloodmagic.client.IVariantProvider)1 WayofTime.bloodmagic.item (WayofTime.bloodmagic.item)1 ItemCuttingFluid (WayofTime.bloodmagic.item.alchemy.ItemCuttingFluid)1 ItemLivingArmourPointsUpgrade (WayofTime.bloodmagic.item.alchemy.ItemLivingArmourPointsUpgrade)1 ItemSentientArmour (WayofTime.bloodmagic.item.armour.ItemSentientArmour)1 ItemPackSacrifice (WayofTime.bloodmagic.item.gear.ItemPackSacrifice)1 ItemPackSelfSacrifice (WayofTime.bloodmagic.item.gear.ItemPackSelfSacrifice)1 ItemFluidRouterFilter (WayofTime.bloodmagic.item.routing.ItemFluidRouterFilter)1 ItemNodeRouter (WayofTime.bloodmagic.item.routing.ItemNodeRouter)1