BiomesOPlenty/src/minecraft/biomesoplenty/items/ItemBOPSlab.java

39 lines
1.1 KiB
Java
Raw Normal View History

2013-05-03 13:00:44 +00:00
package biomesoplenty.items;
import net.minecraft.block.Block;
import net.minecraft.block.BlockHalfSlab;
import net.minecraft.item.ItemSlab;
import net.minecraft.item.ItemStack;
import biomesoplenty.blocks.BlockBOPSlab;
import com.google.common.base.Optional;
public class ItemBOPSlab extends ItemSlab
{
private static Optional<BlockHalfSlab> singleSlab = Optional.absent();
private static Optional<BlockHalfSlab> doubleSlab = Optional.absent();
2013-05-31 10:34:02 +00:00
2013-05-03 13:00:44 +00:00
static public void setSlabs(BlockHalfSlab singleSlab, BlockHalfSlab doubleSlab)
{
ItemBOPSlab.singleSlab = Optional.of(singleSlab);
ItemBOPSlab.doubleSlab = Optional.of(doubleSlab);
}
public ItemBOPSlab(int id) {
super(id, singleSlab.get(), doubleSlab.get(), id == doubleSlab.get().blockID);
}
2013-05-31 10:34:02 +00:00
2013-05-03 13:00:44 +00:00
@Override
2013-05-31 10:34:02 +00:00
public int getMetadata(int meta)
{
return meta & 7;
}
2013-05-03 13:00:44 +00:00
@Override
public String getUnlocalizedName(ItemStack itemStack) {
2013-05-31 10:34:02 +00:00
BlockBOPSlab slab = (BlockBOPSlab)Block.blocksList[itemStack.itemID];
2013-06-09 05:47:52 +00:00
2013-06-09 00:39:12 +00:00
return super.getUnlocalizedName() + "." + (new StringBuilder()).append(slab.getFullSlabName(itemStack.getItemDamage())).toString();
2013-05-03 13:00:44 +00:00
}
}