Ejemplo n.º 1
0
 public override bool OnItemUse(net.minecraft.src.ItemStack itemstack, net.minecraft.src.EntityPlayer entityplayer, net.minecraft.src.World world, int i, int j, int k, int l)
 {
     if (l == 0)
     {
         return(false);
     }
     if (!world.GetBlockMaterial(i, j, k).IsSolid())
     {
         return(false);
     }
     if (l == 1)
     {
         j++;
     }
     if (l == 2)
     {
         k--;
     }
     if (l == 3)
     {
         k++;
     }
     if (l == 4)
     {
         i--;
     }
     if (l == 5)
     {
         i++;
     }
     if (!net.minecraft.src.Block.SIGN_POST.CanPlaceBlockAt(world, i, j, k))
     {
         return(false);
     }
     if (l == 1)
     {
         world.SetBlockAndMetadataWithNotify(
             i, j, k,
             net.minecraft.src.Block.SIGN_POST.ID,
             net.minecraft.src.MathHelper.Floor_double((double)(((entityplayer.rotationYaw + 180F) * 16F) / 360F) + 0.5D) & 0xf);
     }
     else
     {
         world.SetBlockAndMetadataWithNotify(i, j, k, net.minecraft.src.Block.WALL_SIGN.ID, l);
     }
     itemstack.stackSize--;
     net.minecraft.src.TileEntitySign tileentitysign = (net.minecraft.src.TileEntitySign
                                                        )world.GetBlockTileEntity(i, j, k);
     if (tileentitysign != null)
     {
         entityplayer.DisplayGUIEditSign(tileentitysign);
     }
     return(true);
 }