You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.8 KiB
Java
59 lines
1.8 KiB
Java
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 registerBlockIcons(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.)
|
|
*/
|
|
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;
|
|
}
|
|
}
|
|
} |