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