コード例 #1
0
 private void highlightBoardSquare(int row, int col) {
   Cuboid sq = getSquare(row, col);
   MaterialData squareHighlightColor = boardStyle.getHighlightMaterial(col + (row % 2) % 2 == 1);
   switch (boardStyle.getHighlightStyle()) {
     case EDGES:
       sq.getFace(CuboidDirection.East).fill(squareHighlightColor);
       sq.getFace(CuboidDirection.North).fill(squareHighlightColor);
       sq.getFace(CuboidDirection.West).fill(squareHighlightColor);
       sq.getFace(CuboidDirection.South).fill(squareHighlightColor);
       break;
     case CORNERS:
       for (Block b : sq.corners()) {
         b.setTypeIdAndData(
             squareHighlightColor.getItemTypeId(), squareHighlightColor.getData(), false);
       }
       break;
     case CHECKERED:
     case CHEQUERED:
       for (Block b : sq) {
         if ((b.getLocation().getBlockX() - b.getLocation().getBlockZ()) % 2 == 0) {
           b.setTypeIdAndData(
               squareHighlightColor.getItemTypeId(), squareHighlightColor.getData(), false);
         }
       }
       break;
     default:
       break;
   }
   if (ChessCraft.getInstance().getDynmapIntegration() != null) {
     ChessCraft.getInstance().getDynmapIntegration().triggerUpdate(sq);
   }
 }
コード例 #2
0
ファイル: ChessBoard.java プロジェクト: woochany/ChessCraft
 private void highlightBoardSquare(int row, int col, boolean highlight) {
   if (!highlight) {
     paintBoardSquare(row, col, null);
   } else {
     Cuboid sq = getSquare(row, col);
     MaterialWithData squareHighlightColor =
         boardStyle.getHighlightMaterial(col + (row % 2) % 2 == 1);
     switch (boardStyle.getHighlightStyle()) {
       case EDGES:
         sq.getFace(CuboidDirection.East).fill(squareHighlightColor);
         sq.getFace(CuboidDirection.North).fill(squareHighlightColor);
         sq.getFace(CuboidDirection.West).fill(squareHighlightColor);
         sq.getFace(CuboidDirection.South).fill(squareHighlightColor);
         break;
       case CORNERS:
         for (Block b : sq.corners()) {
           squareHighlightColor.applyToBlock(b);
         }
         break;
       case CHECKERED:
       case CHEQUERED:
         for (Block b : sq) {
           if ((b.getLocation().getBlockX() - b.getLocation().getBlockZ()) % 2 == 0) {
             squareHighlightColor.applyToBlock(b.getLocation().getBlock());
           }
         }
         break;
     }
   }
 }
コード例 #3
0
 private void paintFrame(MassBlockUpdate mbu) {
   int fw = boardStyle.getFrameWidth();
   MaterialData fm = boardStyle.getFrameMaterial();
   frameBoard.getFace(CuboidDirection.West).expand(CuboidDirection.East, fw - 1).fill(fm, mbu);
   frameBoard.getFace(CuboidDirection.South).expand(CuboidDirection.North, fw - 1).fill(fm, mbu);
   frameBoard.getFace(CuboidDirection.East).expand(CuboidDirection.West, fw - 1).fill(fm, mbu);
   frameBoard.getFace(CuboidDirection.North).expand(CuboidDirection.South, fw - 1).fill(fm, mbu);
 }
コード例 #4
0
 private void highlightSelectedBoardSquare(int sqi) {
   Cuboid sq = getSquare(Chess.sqiToRow(sqi), Chess.sqiToCol(sqi));
   MaterialData squareHighlightColor = boardStyle.getSelectedHighlightMaterial();
   sq.getFace(CuboidDirection.East).fill(squareHighlightColor);
   sq.getFace(CuboidDirection.North).fill(squareHighlightColor);
   sq.getFace(CuboidDirection.West).fill(squareHighlightColor);
   sq.getFace(CuboidDirection.South).fill(squareHighlightColor);
   if (ChessCraft.getInstance().getDynmapIntegration() != null) {
     ChessCraft.getInstance().getDynmapIntegration().triggerUpdate(sq);
   }
 }
コード例 #5
0
  private void paintEnclosure(MassBlockUpdate mbu) {
    aboveFullBoard.getFace(CuboidDirection.North).fill(boardStyle.getEnclosureMaterial(), mbu);
    aboveFullBoard.getFace(CuboidDirection.East).fill(boardStyle.getEnclosureMaterial(), mbu);
    aboveFullBoard.getFace(CuboidDirection.South).fill(boardStyle.getEnclosureMaterial(), mbu);
    aboveFullBoard.getFace(CuboidDirection.West).fill(boardStyle.getEnclosureMaterial(), mbu);

    fullBoard.getFace(CuboidDirection.Up).fill(boardStyle.getEnclosureMaterial(), mbu);

    if (!boardStyle.getEnclosureMaterial().equals(boardStyle.getStrutsMaterial())) {
      paintStruts(mbu);
    }
  }
コード例 #6
0
  private void paintStruts(MassBlockUpdate mbu) {
    MaterialData struts = boardStyle.getStrutsMaterial();

    // vertical struts at the frame corners
    Cuboid c =
        new Cuboid(frameBoard.getLowerNE())
            .shift(CuboidDirection.Up, 1)
            .expand(CuboidDirection.Up, boardStyle.getHeight());
    c.fill(struts, mbu);
    c = c.shift(CuboidDirection.South, frameBoard.getSizeX() - 1);
    c.fill(struts, mbu);
    c = c.shift(CuboidDirection.West, frameBoard.getSizeZ() - 1);
    c.fill(struts, mbu);
    c = c.shift(CuboidDirection.North, frameBoard.getSizeZ() - 1);
    c.fill(struts, mbu);

    // horizontal struts along roof edge
    Cuboid roof = frameBoard.shift(CuboidDirection.Up, boardStyle.getHeight() + 1);
    roof.getFace(CuboidDirection.East).fill(struts, mbu);
    roof.getFace(CuboidDirection.North).fill(struts, mbu);
    roof.getFace(CuboidDirection.West).fill(struts, mbu);
    roof.getFace(CuboidDirection.South).fill(struts, mbu);
  }