BiomesOPlenty/common/biomesoplenty/itemblocks/ItemBlockSlab.java

39 lines
1.1 KiB
Java
Raw Normal View History

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.block.BlockHalfSlab;
import net.minecraft.item.ItemSlab;
import net.minecraft.item.ItemStack;
import biomesoplenty.blocks.BlockBOPSlab;
import com.google.common.base.Optional;
2013-07-03 07:51:39 +00:00
public class ItemBlockSlab extends ItemSlab
2013-05-03 13:00:44 +00:00
{
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)
{
2013-07-03 07:51:39 +00:00
ItemBlockSlab.singleSlab = Optional.of(singleSlab);
ItemBlockSlab.doubleSlab = Optional.of(doubleSlab);
2013-05-03 13:00:44 +00:00
}
2013-07-03 07:51:39 +00:00
public ItemBlockSlab(int id) {
2013-05-03 13:00:44 +00:00
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
}
}