package net.minecraft.item;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntitySign;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class ItemSign extends Item
{
private static final String __OBFID = "CL_00000064";
public ItemSign()
{
this.maxStackSize = 16;
this.setCreativeTab(CreativeTabs.tabDecorations);
}
/**
* Description : Callback for item usage. If the item does something special on right clicking, he will have one of
* those. Return True if something happen and false if it don't. This is for ITEMS, not BLOCKS. Args : stack,
* player, world, x, y, z, side, hitX, hitY, hitZ
*/
public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_)
{
if (p_77648_7_ == 0)
{
return false;
}
else if (!p_77648_3_.getBlock(p_77648_4_, p_77648_5_, p_77648_6_).getMaterial().isSolid())
{
return false;
}
else
{
if (p_77648_7_ == 1)
{
++p_77648_5_;
}
if (p_77648_7_ == 2)
{
--p_77648_6_;
}
if (p_77648_7_ == 3)
{
++p_77648_6_;
}
if (p_77648_7_ == 4)
{
--p_77648_4_;
}
if (p_77648_7_ == 5)
{
++p_77648_4_;
}
if (!p_77648_2_.canPlayerEdit(p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_1_))
{
return false;
}
else if (!Blocks.standing_sign.canPlaceBlockAt(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_))
{
return false;
}
else if (p_77648_3_.isRemote)
{
return true;
}
else
{
if (p_77648_7_ == 1)
{
int i1 = MathHelper.floor_double((double)((p_77648_2_.rotationYaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15;
p_77648_3_.setBlock(p_77648_4_, p_77648_5_, p_77648_6_, Blocks.standing_sign, i1, 3);
}
else
{
p_77648_3_.setBlock(p_77648_4_, p_77648_5_, p_77648_6_, Blocks.wall_sign, p_77648_7_, 3);
}
--p_77648_1_.stackSize;
TileEntitySign tileentitysign = (TileEntitySign)p_77648_3_.getTileEntity(p_77648_4_, p_77648_5_, p_77648_6_);
if (tileentitysign != null)
{
p_77648_2_.displayGUIEditSign(tileentitysign);
}
return true;
}
}
}
}