2013-05-23 21:07:28 -07:00
|
|
|
package magicbees.item;
|
2012-12-27 22:40:24 -08:00
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
2013-05-23 21:07:28 -07:00
|
|
|
import magicbees.item.types.WaxType;
|
|
|
|
|
import magicbees.main.utils.VersionInfo;
|
2013-04-15 00:17:50 -07:00
|
|
|
import net.minecraft.client.renderer.texture.IconRegister;
|
2012-12-27 22:40:24 -08:00
|
|
|
import net.minecraft.creativetab.CreativeTabs;
|
|
|
|
|
import net.minecraft.item.Item;
|
|
|
|
|
import net.minecraft.item.ItemStack;
|
2013-04-15 00:17:50 -07:00
|
|
|
import net.minecraft.util.Icon;
|
2013-05-13 13:11:34 -07:00
|
|
|
import cpw.mods.fml.common.registry.GameRegistry;
|
|
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
|
|
|
|
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)
|
|
|
|
|
private Icon secondaryIcon;
|
|
|
|
|
|
2012-12-27 22:40:24 -08:00
|
|
|
public ItemWax(int itemID)
|
|
|
|
|
{
|
|
|
|
|
super(itemID);
|
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());
|
|
|
|
|
}
|
2013-04-15 00:17:50 -07:00
|
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
|
public void registerIcons(IconRegister par1IconRegister)
|
|
|
|
|
{
|
|
|
|
|
this.itemIcon = par1IconRegister.registerIcon(VersionInfo.ModName.toLowerCase() + ":wax.0");
|
|
|
|
|
this.secondaryIcon = par1IconRegister.registerIcon(VersionInfo.ModName.toLowerCase() + ":wax.1");
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-27 22:40:24 -08:00
|
|
|
@Override
|
2013-04-15 00:17:50 -07:00
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
|
public Icon 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)
|
|
|
|
|
public void getSubItems(int id, CreativeTabs tabs, List list)
|
|
|
|
|
{
|
|
|
|
|
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
|
|
|
|
|
public String getItemDisplayName(ItemStack stack)
|
|
|
|
|
{
|
2013-03-06 19:33:09 -08:00
|
|
|
return WaxType.values()[stack.getItemDamage()].getName();
|
2012-12-27 22:40:24 -08:00
|
|
|
}
|
|
|
|
|
}
|