001package net.minecraft.item; 002 003import cpw.mods.fml.relauncher.Side; 004import cpw.mods.fml.relauncher.SideOnly; 005import java.util.List; 006import net.minecraft.creativetab.CreativeTabs; 007 008public class ItemCoal extends Item 009{ 010 public ItemCoal(int par1) 011 { 012 super(par1); 013 this.setHasSubtypes(true); 014 this.setMaxDamage(0); 015 this.setCreativeTab(CreativeTabs.tabMaterials); 016 } 017 018 /** 019 * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have 020 * different names based on their damage or NBT. 021 */ 022 public String getUnlocalizedName(ItemStack par1ItemStack) 023 { 024 return par1ItemStack.getItemDamage() == 1 ? "item.charcoal" : "item.coal"; 025 } 026 027 @SideOnly(Side.CLIENT) 028 029 /** 030 * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) 031 */ 032 public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) 033 { 034 par3List.add(new ItemStack(par1, 1, 0)); 035 par3List.add(new ItemStack(par1, 1, 1)); 036 } 037}