2013-05-23 21:07:28 -07:00
|
|
|
package magicbees.item;
|
2012-12-27 22:40:24 -08:00
|
|
|
|
2015-01-08 21:48:13 -08:00
|
|
|
import java.util.List;
|
|
|
|
|
|
2013-05-13 13:11:34 -07:00
|
|
|
import cpw.mods.fml.common.registry.GameRegistry;
|
2012-12-27 22:40:24 -08:00
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
2013-05-23 21:07:28 -07:00
|
|
|
import magicbees.item.types.ResourceType;
|
|
|
|
|
import magicbees.main.CommonProxy;
|
2013-05-29 11:15:25 -07:00
|
|
|
import magicbees.main.utils.TabMagicBees;
|
2014-04-08 12:39:01 -07:00
|
|
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
2012-12-27 22:40:24 -08:00
|
|
|
import net.minecraft.creativetab.CreativeTabs;
|
|
|
|
|
import net.minecraft.item.Item;
|
|
|
|
|
import net.minecraft.item.ItemStack;
|
2014-04-08 12:39:01 -07:00
|
|
|
import net.minecraft.util.IIcon;
|
|
|
|
|
|
2012-12-27 22:40:24 -08:00
|
|
|
public class ItemMiscResources extends Item
|
|
|
|
|
{
|
2014-04-08 12:39:01 -07:00
|
|
|
private IIcon[] icons = new IIcon[ResourceType.values().length];
|
2013-04-15 00:17:50 -07:00
|
|
|
|
2014-04-08 12:39:01 -07:00
|
|
|
public ItemMiscResources()
|
2012-12-27 22:40:24 -08:00
|
|
|
{
|
2014-04-08 12:39:01 -07:00
|
|
|
super();
|
2013-05-29 11:15:25 -07:00
|
|
|
this.setCreativeTab(TabMagicBees.tabMagicBees);
|
2012-12-27 22:40:24 -08:00
|
|
|
this.setHasSubtypes(true);
|
2013-05-29 11:15:25 -07:00
|
|
|
this.setUnlocalizedName("miscResources");
|
|
|
|
|
GameRegistry.registerItem(this, "miscResources");
|
2012-12-27 22:40:24 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ItemStack getStackForType(ResourceType type)
|
|
|
|
|
{
|
|
|
|
|
return new ItemStack(this, 1, type.ordinal());
|
2015-01-08 21:48:13 -08:00
|
|
|
}
|
2012-12-27 22:40:24 -08:00
|
|
|
|
|
|
|
|
public ItemStack getStackForType(ResourceType type, int count)
|
|
|
|
|
{
|
|
|
|
|
return new ItemStack(this, count, type.ordinal());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
2014-04-08 12:39:01 -07:00
|
|
|
public void getSubItems(Item item, CreativeTabs tabs, List list)
|
2012-12-27 22:40:24 -08:00
|
|
|
{
|
|
|
|
|
for (ResourceType type : ResourceType.values())
|
|
|
|
|
{
|
2013-01-26 13:42:39 -08:00
|
|
|
if (type.showInList)
|
|
|
|
|
{
|
|
|
|
|
list.add(this.getStackForType(type));
|
|
|
|
|
}
|
2012-12-27 22:40:24 -08:00
|
|
|
}
|
|
|
|
|
}
|
2013-04-15 00:17:50 -07:00
|
|
|
|
2015-01-08 21:48:13 -08:00
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
|
public void registerIcons(IIconRegister par1IconRegister)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < ResourceType.values().length; i++)
|
|
|
|
|
{
|
|
|
|
|
this.icons[i] = par1IconRegister.registerIcon(CommonProxy.DOMAIN + ":" + ResourceType.values()[i].getName());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-27 22:40:24 -08:00
|
|
|
@Override
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
2014-04-08 12:39:01 -07:00
|
|
|
public IIcon getIconFromDamage(int meta)
|
2012-12-27 22:40:24 -08:00
|
|
|
{
|
2013-04-15 00:17:50 -07:00
|
|
|
return icons[meta];
|
2012-12-27 22:40:24 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2014-04-08 12:39:01 -07:00
|
|
|
public String getItemStackDisplayName(ItemStack stack)
|
2012-12-27 22:40:24 -08:00
|
|
|
{
|
2013-04-15 00:17:50 -07:00
|
|
|
return ResourceType.values()[stack.getItemDamage()].getLocalizedName();
|
2012-12-27 22:40:24 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|