package com.vanamod.mod.armor;

import com.vanamod.mod.VanaMod;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;

public class ItemVanadiumArmor extends ItemArmor {

    private String textureName;

    public ItemVanadiumArmor(ArmorMaterial material, int armorType, String name) {
        super(material, 0, armorType);
        this.textureName = name;
        this.setUnlocalizedName(name);
        this.setCreativeTab(VanaMod.vanaTab);
    }

    @Override
    public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
        // Effets selon la pièce portée
        if (this.armorType == 3) { // Boots
            player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 20, 0, true)); // Speed I
        }
    }

    @Override
    @SideOnly(Side.CLIENT)
    public void registerIcons(IIconRegister iconRegister) {
        this.itemIcon = iconRegister.registerIcon("vanamod:" + this.textureName);
    }

    @Override
    public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
        if (slot == 2) { // Legs
            return "vanamod:textures/models/armor/vanadium_layer_2.png";
        }
        return "vanamod:textures/models/armor/vanadium_layer_1.png";
    }
}