package net.minecraft.block;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
public class BlockWorkbench extends Block
{
@SideOnly(Side.CLIENT)
private IIcon field_150035_a;
@SideOnly(Side.CLIENT)
private IIcon field_150034_b;
private static final String __OBFID = "CL_00000221";
protected BlockWorkbench()
{
super(Material.wood);
this.setCreativeTab(CreativeTabs.tabDecorations);
}
/**
* Gets the block's texture. Args: side, meta
*/
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta)
{
return side == 1 ? this.field_150035_a : (side == 0 ? Blocks.planks.getBlockTextureFromSide(side) : (side != 2 && side != 4 ? this.blockIcon : this.field_150034_b));
}
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister reg)
{
this.blockIcon = reg.registerIcon(this.getTextureName() + "_side");
this.field_150035_a = reg.registerIcon(this.getTextureName() + "_top");
this.field_150034_b = reg.registerIcon(this.getTextureName() + "_front");
}
/**
* Called upon block activation (right click on the block). Args : world, x, y, z, player, side, hitX, hitY, hitZ.
* Return : Swing hand (client), abort the block placement (server)
*/
public boolean onBlockActivated(World worldIn, int x, int y, int z, EntityPlayer player, int side, float subX, float subY, float subZ)
{
if (worldIn.isRemote)
{
return true;
}
else
{
player.displayGUIWorkbench(x, y, z);
return true;
}
}
}