001 package net.minecraft.src;
002
003 public class BlockWorkbench extends Block
004 {
005 protected BlockWorkbench(int par1)
006 {
007 super(par1, Material.wood);
008 this.blockIndexInTexture = 59;
009 this.setCreativeTab(CreativeTabs.tabDecorations);
010 }
011
012 /**
013 * Returns the block texture based on the side being looked at. Args: side
014 */
015 public int getBlockTextureFromSide(int par1)
016 {
017 return par1 == 1 ? this.blockIndexInTexture - 16 : (par1 == 0 ? Block.planks.getBlockTextureFromSide(0) : (par1 != 2 && par1 != 4 ? this.blockIndexInTexture : this.blockIndexInTexture + 1));
018 }
019
020 /**
021 * Called upon block activation (right click on the block.)
022 */
023 public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
024 {
025 if (par1World.isRemote)
026 {
027 return true;
028 }
029 else
030 {
031 par5EntityPlayer.displayGUIWorkbench(par2, par3, par4);
032 return true;
033 }
034 }
035 }