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