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 BlockStep extends BlockHalfSlab
009    {
010        /** The list of the types of step blocks. */
011        public static final String[] blockStepTypes = new String[] {"stone", "sand", "wood", "cobble", "brick", "smoothStoneBrick"};
012    
013        public BlockStep(int par1, boolean par2)
014        {
015            super(par1, par2, Material.rock);
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            int var3 = par2 & 7;
025            return var3 == 0 ? (par1 <= 1 ? 6 : 5) : (var3 == 1 ? (par1 == 0 ? 208 : (par1 == 1 ? 176 : 192)) : (var3 == 2 ? 4 : (var3 == 3 ? 16 : (var3 == 4 ? Block.brick.blockIndexInTexture : (var3 == 5 ? Block.stoneBrick.blockIndexInTexture : 6)))));
026        }
027    
028        /**
029         * Returns the block texture based on the side being looked at.  Args: side
030         */
031        public int getBlockTextureFromSide(int par1)
032        {
033            return this.getBlockTextureFromSideAndMetadata(par1, 0);
034        }
035    
036        /**
037         * Returns the ID of the items to drop on destruction.
038         */
039        public int idDropped(int par1, Random par2Random, int par3)
040        {
041            return Block.stoneSingleSlab.blockID;
042        }
043    
044        /**
045         * Returns an item stack containing a single instance of the current block type. 'i' is the block's subtype/damage
046         * and is ignored for blocks which do not support subtypes. Blocks which cannot be harvested should return null.
047         */
048        protected ItemStack createStackedBlock(int par1)
049        {
050            return new ItemStack(Block.stoneSingleSlab.blockID, 2, par1 & 7);
051        }
052    
053        /**
054         * Returns the slab block name with step type.
055         */
056        public String getFullSlabName(int par1)
057        {
058            if (par1 < 0 || par1 >= blockStepTypes.length)
059            {
060                par1 = 0;
061            }
062    
063            return super.getBlockName() + "." + blockStepTypes[par1];
064        }
065    
066        @SideOnly(Side.CLIENT)
067    
068        /**
069         * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
070         */
071        public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
072        {
073            if (par1 != Block.stoneDoubleSlab.blockID)
074            {
075                for (int var4 = 0; var4 < 6; ++var4)
076                {
077                    if (var4 != 2)
078                    {
079                        par3List.add(new ItemStack(par1, 1, var4));
080                    }
081                }
082            }
083        }
084    }