public void requestInventoryOpen(Location loc, Locomotion move) {
    // System.out.println("Opening chest");
    move.lookAt(loc);
    try {
      out.write(8);
      out.writeInt((int) (loc.getX()));
      out.write((int) (loc.getY()));
      out.writeInt((int) (loc.getZ()));

      out.write(1);

      out.write(255);
      out.write(255);

      out.write(1);
      out.write(1);
      out.write(1);
      out.closePacket();
      // System.out.println("OPEN CHEST REQUEST SENT");

    } catch (Exception e) {
      System.err.println("Error while using entity.");
    }
    // System.out.println("CHEST opened");
  }
示例#2
0
  /**
   * Takes planned block and puts it in the world.
   *
   * @param plan Planned block
   */
  private void putBlock(BlockPlan plan) {
    inventoryStorage.toBuild(plan);
    Util.logger.log(LogElement.Building, LogLevel.Debug, "Putting block");
    move.lookAt(new Location(plan.x, plan.y, plan.z));
    waitForConfirmation = 0;
    try {
      out.write(10);
      out.writeInt(info.getId());
      out.write(1);
      out.closePacket();

      blockPlacementPacket.sendMessage(
          plan.x, (byte) (plan.y - 1), plan.z, (byte) 1, (byte) 1, (byte) 1, (byte) 1);
    } catch (IOException ex) {
      System.out.println("IO Error while placing a block.");
      System.exit(0);
    }
  }