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