Ejemplo n.º 1
0
  /**
   * Draw the chess piece represented by stone into the given row and column. The actual blocks
   * drawn depend on the board's current chess set.
   *
   * @param row
   * @param col
   * @param stone
   */
  public void paintChessPiece(int row, int col, int stone) {
    // for entity sets, just check that the entity is still at (row,col)
    // for block sets, get the stone and paste its data into the region at (row,col)
    ChessSet cSet = designer != null ? designer.getChessSet() : chessSet;
    if (cSet.hasMovablePieces()) {
      // we don't paint movable pieces; moveChessPiece() can handle those
      return;
    }
    Cuboid region = getPieceRegion(row, col);
    MassBlockUpdate mbu =
        CraftMassBlockUpdate.createMassBlockUpdater(
            ChessCraft.getInstance(), getBoard().getWorld());
    region.fill(0, (byte) 0, mbu);
    if (stone != Chess.NO_STONE) {
      ChessStone cStone = cSet.getStone(stone, getRotation());
      if (cStone != null) {
        cStone.paint(region, mbu);
      } else {
        LogUtils.severe("unknown chess stone " + stone);
      }
    }

    region.expand(CuboidDirection.Down, 1).forceLightLevel(boardStyle.getLightLevel());
    mbu.notifyClients();
    if (ChessCraft.getInstance().getDynmapIntegration() != null) {
      ChessCraft.getInstance().getDynmapIntegration().triggerUpdate(region);
    }
  }
Ejemplo n.º 2
0
 /** Clear full area associated with this board */
 void clearAll() {
   MassBlockUpdate mbu =
       CraftMassBlockUpdate.createMassBlockUpdater(
           ChessCraft.getInstance(), getBoard().getWorld());
   fullBoard.fill(0, (byte) 0, mbu);
   mbu.notifyClients();
   if (ChessCraft.getInstance().getDynmapIntegration() != null) {
     ChessCraft.getInstance().getDynmapIntegration().triggerUpdate(fullBoard);
   }
 }
Ejemplo n.º 3
0
  /**
   * Draw the chess piece represented by stone into the given row and column. The actual blocks
   * drawn depend on the board's current chess set.
   *
   * @param row
   * @param col
   * @param stone
   */
  public void paintChessPiece(int row, int col, int stone) {
    Cuboid region = getPieceRegion(row, col);
    MassBlockUpdate mbu = CraftMassBlockUpdate.createMassBlockUpdater(getBoard().getWorld());
    region.fill(0, (byte) 0, mbu);
    ChessSet cSet = designer != null ? designer.getChessSet() : chessPieceSet;
    if (stone != Chess.NO_STONE) {
      ChessStone cStone = cSet.getStone(stone, getRotation());
      if (cStone != null) {
        paintChessPiece(region, cStone, mbu);
      } else {
        LogUtils.severe("unknown piece: " + stone);
      }
    }

    region.expand(CuboidDirection.Down, 1).forceLightLevel(boardStyle.getLightLevel());
    mbu.notifyClients();
  }
Ejemplo n.º 4
0
 /** Clear full area associated with this board */
 void clearAll() {
   MassBlockUpdate mbu = CraftMassBlockUpdate.createMassBlockUpdater(getBoard().getWorld());
   fullBoard.fill(0, (byte) 0, mbu);
   mbu.notifyClients();
 }