    001package net.minecraft.block;
    002
    003import cpw.mods.fml.relauncher.Side;
    004import cpw.mods.fml.relauncher.SideOnly;
    005import net.minecraft.block.material.Material;
    006import net.minecraft.client.renderer.texture.IconRegister;
    007import net.minecraft.creativetab.CreativeTabs;
    008import net.minecraft.entity.player.EntityPlayer;
    009import net.minecraft.util.Icon;
    010import net.minecraft.world.World;
    011
    012public class BlockWorkbench extends Block
    013{
    014    @SideOnly(Side.CLIENT)
    015    private Icon field_94385_a;
    016    @SideOnly(Side.CLIENT)
    017    private Icon field_94384_b;
    018
    019    protected BlockWorkbench(int par1)
    020    {
    021        super(par1, Material.wood);
    022        this.setCreativeTab(CreativeTabs.tabDecorations);
    023    }
    024
    025    @SideOnly(Side.CLIENT)
    026
    027    /**
    028     * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
    029     */
    030    public Icon getBlockTextureFromSideAndMetadata(int par1, int par2)
    031    {
    032        return par1 == 1 ? this.field_94385_a : (par1 == 0 ? Block.planks.getBlockTextureFromSide(par1) : (par1 != 2 && par1 != 4 ? this.field_94336_cN : this.field_94384_b));
    033    }
    034
    035    @SideOnly(Side.CLIENT)
    036    public void func_94332_a(IconRegister par1IconRegister)
    037    {
    038        this.field_94336_cN = par1IconRegister.func_94245_a("workbench_side");
    039        this.field_94385_a = par1IconRegister.func_94245_a("workbench_top");
    040        this.field_94384_b = par1IconRegister.func_94245_a("workbench_front");
    041    }
    042
    043    /**
    044     * Called upon block activation (right click on the block.)
    045     */
    046    public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
    047    {
    048        if (par1World.isRemote)
    049        {
    050            return true;
    051        }
    052        else
    053        {
    054            par5EntityPlayer.displayGUIWorkbench(par2, par3, par4);
    055            return true;
    056        }
    057    }
    058}