package com.zivilon.cinder_loe.items;

import lotr.common.item.LOTRMaterial;
import lotr.common.item.LOTRItemSword;
import com.zivilon.cinder_loe.LoECreativeTabs;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;

import java.util.List;

public class ForgingKit extends Item {
    public IIcon[] icons;

    public ForgingKit() {
        this.setHasSubtypes(true);
        setMaxStackSize(64);
        this.setMaxDamage(0);
        setCreativeTab(LoECreativeTabs.tabMiscLoE);
    }

        @Override
    public IIcon getIconFromDamage(int damage) {
        if (damage < 0 || damage >= icons.length) {
            damage = 0;
        }
        return this.icons[damage];
    }

        @Override
    public void registerIcons(IIconRegister iconRegister) {
        this.icons = new IIcon[2];
        this.icons[0] = iconRegister.registerIcon("lotr:repair_kit");
        this.icons[1] = iconRegister.registerIcon("lotr:upgrade_kit");
    }

    @Override
    public String getUnlocalizedName(ItemStack item) {
        switch(item.getItemDamage()) {
            case 0:
                return "item.repair_kit";
            case 1:
                return "item.upgrade_kit";
            default:
                return "item.repair_kit";
        }
    }

    @Override
    public void getSubItems(Item item, CreativeTabs tab, List list) {
        for (int i = 0; i < icons.length; i++) {
            list.add(new ItemStack(item, 1, i));
        }
    }
}
