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;
|
|
|
|
|
|
2014-04-08 12:39:01 -07:00
|
|
|
import cpw.mods.fml.common.registry.GameRegistry;
|
|
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
2013-05-23 21:07:28 -07:00
|
|
|
import magicbees.item.types.WaxType;
|
2013-09-17 19:40:26 -07:00
|
|
|
import magicbees.main.CommonProxy;
|
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;
|
2015-01-08 21:48:13 -08:00
|
|
|
import forestry.api.core.Tabs;
|
2012-12-27 22:40:24 -08:00
|
|
|
|
|
|
|
|
public class ItemWax extends Item
|
|
|
|
|
{
|
2013-04-15 00:17:50 -07:00
|
|
|
@SideOnly(Side.CLIENT)
|
2014-04-08 12:39:01 -07:00
|
|
|
private IIcon secondaryIcon;
|
2013-04-15 00:17:50 -07:00
|
|
|
|
2014-04-08 12:39:01 -07:00
|
|
|
public ItemWax()
|
2012-12-27 22:40:24 -08:00
|
|
|
{
|
2014-04-08 12:39:01 -07:00
|
|
|
super();
|
2013-01-26 13:42:39 -08:00
|
|
|
this.setCreativeTab(Tabs.tabApiculture);
|
2012-12-27 22:40:24 -08:00
|
|
|
this.setHasSubtypes(true);
|
2013-05-29 11:15:25 -07:00
|
|
|
this.setUnlocalizedName("wax");
|
|
|
|
|
GameRegistry.registerItem(this, "wax");
|
2012-12-27 22:40:24 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ItemStack getStackForType(WaxType type)
|
|
|
|
|
{
|
|
|
|
|
return new ItemStack(this, 1, type.ordinal());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ItemStack getStackForType(WaxType type, int count)
|
|
|
|
|
{
|
|
|
|
|
return new ItemStack(this, count, type.ordinal());
|
|
|
|
|
}
|
2015-01-08 21:48:13 -08:00
|
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
|
public void registerIcons(IIconRegister par1IconRegister)
|
|
|
|
|
{
|
|
|
|
|
this.itemIcon = par1IconRegister.registerIcon(CommonProxy.DOMAIN + ":wax.0");
|
|
|
|
|
this.secondaryIcon = par1IconRegister.registerIcon(CommonProxy.DOMAIN + ":wax.1");
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-27 22:40:24 -08:00
|
|
|
@Override
|
2013-04-15 00:17:50 -07:00
|
|
|
@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-06-04 13:26:44 -07:00
|
|
|
return (WaxType.values()[meta].sparkly) ? this.itemIcon : this.secondaryIcon;
|
2012-12-27 22:40:24 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@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 (WaxType type : WaxType.values())
|
|
|
|
|
{
|
|
|
|
|
list.add(this.getStackForType(type));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
|
public int getColorFromItemStack(ItemStack stack, int pass)
|
|
|
|
|
{
|
|
|
|
|
int colour = 0xffffff;
|
|
|
|
|
int meta = stack.getItemDamage();
|
|
|
|
|
if (meta >= 0 && meta < WaxType.values().length)
|
|
|
|
|
{
|
|
|
|
|
colour = WaxType.values()[meta].colour;
|
|
|
|
|
}
|
|
|
|
|
return colour;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2014-04-08 12:39:01 -07:00
|
|
|
public String getItemStackDisplayName(ItemStack stack)
|
2012-12-27 22:40:24 -08:00
|
|
|
{
|
2013-03-06 19:33:09 -08:00
|
|
|
return WaxType.values()[stack.getItemDamage()].getName();
|
2012-12-27 22:40:24 -08:00
|
|
|
}
|
|
|
|
|
}
|