public void handlePlace(Packet15Place par1Packet15Place) {
    WorldServer worldserver = mcServer.worldServerForDimension(playerEntity.dimension);
    ItemStack itemstack = playerEntity.inventory.getCurrentItem();
    boolean flag = false;
    int i = par1Packet15Place.getXPosition();
    int j = par1Packet15Place.getYPosition();
    int k = par1Packet15Place.getZPosition();
    int l = par1Packet15Place.getDirection();
    boolean flag1 =
        worldserver.actionsAllowed =
            worldserver.provider.worldType != 0
                || mcServer.getConfigurationManager().areCommandsAllowed(playerEntity.username)
                || mcServer.isSinglePlayer();

    if (par1Packet15Place.getDirection() == 255) {
      if (itemstack == null) {
        return;
      }

      playerEntity.theItemInWorldManager.tryUseItem(playerEntity, worldserver, itemstack);
    } else if (par1Packet15Place.getYPosition() < mcServer.getBuildLimit() - 1
        || par1Packet15Place.getDirection() != 1
            && par1Packet15Place.getYPosition() < mcServer.getBuildLimit()) {
      ChunkCoordinates chunkcoordinates = worldserver.getSpawnPoint();
      int i1 = MathHelper.abs_int(i - chunkcoordinates.posX);
      int j1 = MathHelper.abs_int(k - chunkcoordinates.posZ);

      if (i1 > j1) {
        j1 = i1;
      }

      if (field_72587_r
          && playerEntity.getDistanceSq((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D)
              < 64D
          && (j1 > 16 || flag1)) {
        playerEntity.theItemInWorldManager.activateBlockOrUseItem(
            playerEntity,
            worldserver,
            itemstack,
            i,
            j,
            k,
            l,
            par1Packet15Place.getXOffset(),
            par1Packet15Place.getYOffset(),
            par1Packet15Place.getZOffset());
      }

      flag = true;
    } else {
      playerEntity.serverForThisPlayer.sendPacketToPlayer(
          new Packet3Chat(
              (new StringBuilder())
                  .append("\2477Height limit for building is ")
                  .append(mcServer.getBuildLimit())
                  .toString()));
      flag = true;
    }

    if (flag) {
      playerEntity.serverForThisPlayer.sendPacketToPlayer(
          new Packet53BlockChange(i, j, k, worldserver));

      if (l == 0) {
        j--;
      }

      if (l == 1) {
        j++;
      }

      if (l == 2) {
        k--;
      }

      if (l == 3) {
        k++;
      }

      if (l == 4) {
        i--;
      }

      if (l == 5) {
        i++;
      }

      playerEntity.serverForThisPlayer.sendPacketToPlayer(
          new Packet53BlockChange(i, j, k, worldserver));
    }

    itemstack = playerEntity.inventory.getCurrentItem();

    if (itemstack != null && itemstack.stackSize == 0) {
      playerEntity.inventory.mainInventory[playerEntity.inventory.currentItem] = null;
      itemstack = null;
    }

    if (itemstack == null || itemstack.getMaxItemUseDuration() == 0) {
      playerEntity.playerInventoryBeingManipulated = true;
      playerEntity.inventory.mainInventory[playerEntity.inventory.currentItem] =
          ItemStack.copyItemStack(
              playerEntity.inventory.mainInventory[playerEntity.inventory.currentItem]);
      Slot slot =
          playerEntity.craftingInventory.getSlotFromInventory(
              playerEntity.inventory, playerEntity.inventory.currentItem);
      playerEntity.craftingInventory.updateCraftingResults();
      playerEntity.playerInventoryBeingManipulated = false;

      if (!ItemStack.areItemStacksEqual(
          playerEntity.inventory.getCurrentItem(), par1Packet15Place.getItemStack())) {
        sendPacketToPlayer(
            new Packet103SetSlot(
                playerEntity.craftingInventory.windowId,
                slot.slotNumber,
                playerEntity.inventory.getCurrentItem()));
      }
    }

    worldserver.actionsAllowed = false;
  }
  public void handleBlockDig(Packet14BlockDig par1Packet14BlockDig) {
    WorldServer worldserver = mcServer.worldServerForDimension(playerEntity.dimension);

    if (par1Packet14BlockDig.status == 4) {
      playerEntity.dropOneItem();
      return;
    }

    if (par1Packet14BlockDig.status == 5) {
      playerEntity.stopUsingItem();
      return;
    }

    boolean flag =
        worldserver.actionsAllowed =
            worldserver.provider.worldType != 0
                || mcServer.getConfigurationManager().areCommandsAllowed(playerEntity.username)
                || mcServer.isSinglePlayer();
    boolean flag1 = false;

    if (par1Packet14BlockDig.status == 0) {
      flag1 = true;
    }

    if (par1Packet14BlockDig.status == 2) {
      flag1 = true;
    }

    int i = par1Packet14BlockDig.xPosition;
    int j = par1Packet14BlockDig.yPosition;
    int k = par1Packet14BlockDig.zPosition;

    if (flag1) {
      double d = playerEntity.posX - ((double) i + 0.5D);
      double d1 = (playerEntity.posY - ((double) j + 0.5D)) + 1.5D;
      double d3 = playerEntity.posZ - ((double) k + 0.5D);
      double d5 = d * d + d1 * d1 + d3 * d3;

      if (d5 > 36D) {
        return;
      }

      if (j >= mcServer.getBuildLimit()) {
        return;
      }
    }

    ChunkCoordinates chunkcoordinates = worldserver.getSpawnPoint();
    int l = MathHelper.abs_int(i - chunkcoordinates.posX);
    int i1 = MathHelper.abs_int(k - chunkcoordinates.posZ);

    if (l > i1) {
      i1 = l;
    }

    if (par1Packet14BlockDig.status == 0) {
      if (i1 > 16 || flag) {
        playerEntity.theItemInWorldManager.onBlockClicked(i, j, k, par1Packet14BlockDig.face);
      } else {
        playerEntity.serverForThisPlayer.sendPacketToPlayer(
            new Packet53BlockChange(i, j, k, worldserver));
      }
    } else if (par1Packet14BlockDig.status == 2) {
      playerEntity.theItemInWorldManager.uncheckedTryHarvestBlock(i, j, k);

      if (worldserver.getBlockId(i, j, k) != 0) {
        playerEntity.serverForThisPlayer.sendPacketToPlayer(
            new Packet53BlockChange(i, j, k, worldserver));
      }
    } else if (par1Packet14BlockDig.status == 1) {
      playerEntity.theItemInWorldManager.destroyBlockInWorldPartially(i, j, k);

      if (worldserver.getBlockId(i, j, k) != 0) {
        playerEntity.serverForThisPlayer.sendPacketToPlayer(
            new Packet53BlockChange(i, j, k, worldserver));
      }
    } else if (par1Packet14BlockDig.status == 3) {
      double d2 = playerEntity.posX - ((double) i + 0.5D);
      double d4 = playerEntity.posY - ((double) j + 0.5D);
      double d6 = playerEntity.posZ - ((double) k + 0.5D);
      double d7 = d2 * d2 + d4 * d4 + d6 * d6;

      if (d7 < 256D) {
        playerEntity.serverForThisPlayer.sendPacketToPlayer(
            new Packet53BlockChange(i, j, k, worldserver));
      }
    }

    worldserver.actionsAllowed = false;
  }