2013-07-03 07:51:39 +00:00
|
|
|
package biomesoplenty.itemblocks;
|
2013-05-03 13:00:44 +00:00
|
|
|
|
|
|
|
import net.minecraft.block.Block;
|
|
|
|
import net.minecraft.item.ItemBlock;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.util.Icon;
|
|
|
|
|
2013-07-03 07:51:39 +00:00
|
|
|
public class ItemBlockSapling extends ItemBlock
|
2013-05-03 13:00:44 +00:00
|
|
|
{
|
2013-09-10 13:52:37 +00:00
|
|
|
private static final String[] saplings = new String[] {"apple", "yellowautumn", "bamboo", "magic", "dark", "dead", "fir", "holy", "orangeautumn", "origin", "pinkcherry", "maple", "whitecherry", "hellbark", "jacaranda", "persimmon"};
|
2013-09-10 14:35:39 +00:00
|
|
|
private static final int MAX = 15;
|
2013-05-31 10:34:02 +00:00
|
|
|
|
2013-07-03 07:51:39 +00:00
|
|
|
public ItemBlockSapling(int par1)
|
2013-05-31 10:34:02 +00:00
|
|
|
{
|
|
|
|
super(par1);
|
|
|
|
setMaxDamage(0);
|
|
|
|
setHasSubtypes(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getMetadata(int meta)
|
|
|
|
{
|
|
|
|
return meta & 15;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getUnlocalizedName(ItemStack itemStack)
|
|
|
|
{
|
|
|
|
int meta = itemStack.getItemDamageForDisplay() > MAX ? 0 : itemStack.getItemDamageForDisplay();
|
2013-06-09 00:39:12 +00:00
|
|
|
return super.getUnlocalizedName() + "." + (new StringBuilder()).append(saplings[meta]).append("Sapling").toString();
|
2013-05-31 10:34:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Icon getIconFromDamage(int meta)
|
|
|
|
{
|
|
|
|
return Block.blocksList[itemID].getIcon(0, meta);
|
|
|
|
}
|
2013-05-03 13:00:44 +00:00
|
|
|
}
|