    001package net.minecraft.block;
    002
    003import cpw.mods.fml.relauncher.Side;
    004import cpw.mods.fml.relauncher.SideOnly;
    005import java.util.List;
    006import java.util.Random;
    007import net.minecraft.block.material.Material;
    008import net.minecraft.client.renderer.texture.IconRegister;
    009import net.minecraft.creativetab.CreativeTabs;
    010import net.minecraft.item.ItemStack;
    011import net.minecraft.util.Icon;
    012
    013public class BlockWoodSlab extends BlockHalfSlab
    014{
    015    /** The type of tree this slab came from. */
    016    public static final String[] woodType = new String[] {"oak", "spruce", "birch", "jungle"};
    017
    018    public BlockWoodSlab(int par1, boolean par2)
    019    {
    020        super(par1, par2, Material.wood);
    021        this.setCreativeTab(CreativeTabs.tabBlock);
    022    }
    023
    024    @SideOnly(Side.CLIENT)
    025
    026    /**
    027     * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
    028     */
    029    public Icon getIcon(int par1, int par2)
    030    {
    031        return Block.planks.getIcon(par1, par2 & 7);
    032    }
    033
    034    /**
    035     * Returns the ID of the items to drop on destruction.
    036     */
    037    public int idDropped(int par1, Random par2Random, int par3)
    038    {
    039        return Block.woodSingleSlab.blockID;
    040    }
    041
    042    /**
    043     * Returns an item stack containing a single instance of the current block type. 'i' is the block's subtype/damage
    044     * and is ignored for blocks which do not support subtypes. Blocks which cannot be harvested should return null.
    045     */
    046    protected ItemStack createStackedBlock(int par1)
    047    {
    048        return new ItemStack(Block.woodSingleSlab.blockID, 2, par1 & 7);
    049    }
    050
    051    /**
    052     * Returns the slab block name with step type.
    053     */
    054    public String getFullSlabName(int par1)
    055    {
    056        if (par1 < 0 || par1 >= woodType.length)
    057        {
    058            par1 = 0;
    059        }
    060
    061        return super.getUnlocalizedName() + "." + woodType[par1];
    062    }
    063
    064    @SideOnly(Side.CLIENT)
    065
    066    /**
    067     * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
    068     */
    069    public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
    070    {
    071        if (par1 != Block.woodDoubleSlab.blockID)
    072        {
    073            for (int j = 0; j < 4; ++j)
    074            {
    075                par3List.add(new ItemStack(par1, 1, j));
    076            }
    077        }
    078    }
    079
    080    @SideOnly(Side.CLIENT)
    081
    082    /**
    083     * When this method is called, your block should register all the icons it needs with the given IconRegister. This
    084     * is the only chance you get to register icons.
    085     */
    086    public void registerIcons(IconRegister par1IconRegister) {}
    087}