mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-20 12:19:48 +00:00
40 lines
1.1 KiB
Java
40 lines
1.1 KiB
Java
package tconstruct.items.blocks;
|
|
|
|
import net.minecraft.item.ItemBlock;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.util.Icon;
|
|
import net.minecraft.util.MathHelper;
|
|
import tconstruct.common.TContent;
|
|
import cpw.mods.fml.relauncher.Side;
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
|
|
|
public class SlimeTallGrassItem extends ItemBlock
|
|
{
|
|
public static final String blockType[] = { "tallgrass", "tallgrass.fern" };
|
|
|
|
public SlimeTallGrassItem(int id)
|
|
{
|
|
super(id);
|
|
setMaxDamage(0);
|
|
setHasSubtypes(true);
|
|
}
|
|
|
|
public int getMetadata (int meta)
|
|
{
|
|
return meta;
|
|
}
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
public Icon getIconFromDamage (int meta)
|
|
{
|
|
int arr = MathHelper.clamp_int(meta, 0, blockType.length);
|
|
return TContent.slimeTallGrass.getIcon(0, arr);
|
|
}
|
|
|
|
public String getUnlocalizedName (ItemStack itemstack)
|
|
{
|
|
int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length - 1);
|
|
return (new StringBuilder()).append("block.slime.").append(blockType[pos]).toString();
|
|
}
|
|
}
|