Files
MagicBees/thaumicbees_src/thaumicbees/item/ItemComb.java
T
MysteriousAges 63bb014de8 Bugfixes:
* Re-enabled capsules being added to the liquid dictionary.
* Discovered cause of items being added to creative tabs twice, and killed it.
2013-01-28 14:22:40 -08:00

102 lines
2.0 KiB
Java

package thaumicbees.item;
import java.util.List;
import thaumicbees.item.types.CombType;
import thaumicbees.main.CommonProxy;
import thaumicbees.main.ThaumicBees;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.core.Tabs;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class ItemComb extends Item
{
public ItemComb(int itemID)
{
super(itemID);
this.setTextureFile(CommonProxy.FORESTRY_GFX_ITEMS);
this.setCreativeTab(Tabs.tabApiculture);
this.setHasSubtypes(true);
}
public ItemStack getStackForType(CombType type)
{
return new ItemStack(this, 1, type.ordinal());
}
public ItemStack getStackForType(CombType type, int count)
{
return new ItemStack(this, count, type.ordinal());
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(int id, CreativeTabs tabs, List list)
{
for (CombType type : CombType.values())
{
if (type.showInList)
{
list.add(this.getStackForType(type));
}
}
}
@Override
@SideOnly(Side.CLIENT)
public boolean requiresMultipleRenderPasses()
{
return true;
}
@Override
public int getRenderPasses(int meta)
{
int passes = 2;
return passes;
}
@Override
public int getIconIndex(ItemStack stack, int pass)
{
int idx = 107;
// 107, 108 are the base forestry honeycomb textures.
if (pass >= 1)
{
idx = 108;
}
return idx;
}
@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int pass)
{
int meta = Math.max(0, Math.min(CombType.values().length - 1, stack.getItemDamage()));
int colour = CombType.values()[meta].combColour[0];
if (pass >= 1)
{
colour = CombType.values()[meta].combColour[1];
}
return colour;
}
@Override
public String getItemDisplayName(ItemStack stack)
{
String result = "";
int meta = stack.getItemDamage();
if (meta >= 0 && meta < CombType.values().length)
{
result = CombType.values()[meta].name;
}
return result;
}
}