コード例 #1
0
 /**
  * Place structures in chunk.
  *
  * @param buffer a MutableBlockVolume object to place blocks in
  * @param struct a StructureChunk to place
  * @param check a BlockState to replace (will replace with list later)
  */
 private void placeBlocks(MutableBlockVolume buffer, StructureChunk struct) {
   BlockState state = struct.getBlock().getState();
   BlockType intermediate;
   BlockType below;
   Random rand = new Random();
   if (state != null) {
     for (ThreePoint point : struct.getPoints()) {
       if (point.y < 180 && point.y > 2) {
         intermediate =
             buffer.getRelativeBlockView().getBlock(point.x, point.y, point.z).getType();
         below = buffer.getRelativeBlockView().getBlock(point.x, point.y - 1, point.z).getType();
         if (blockStone(intermediate)) {
           buffer.getRelativeBlockView().setBlock(point.x, point.y, point.z, state);
         } else if (blockAir(intermediate)) {
           if (blockStone(below) && rand.nextInt(7) == 0) {
             buffer.getRelativeBlockView().setBlock(point.x, point.y, point.z, state);
           } else if (blockRegolith(below, state.getType()) && rand.nextInt(15) == 0) {
             buffer.getRelativeBlockView().setBlock(point.x, point.y, point.z, state);
           }
         } else if (blockRegolith(intermediate, state.getType())) {
           if (blockStone(below) && rand.nextInt(3) == 0) {
             buffer.getRelativeBlockView().setBlock(point.x, point.y, point.z, state);
           } else if (blockRegolith(below, state.getType()) && rand.nextInt(30) == 0) {
             buffer.getRelativeBlockView().setBlock(point.x, point.y, point.z, state);
           }
         }
       }
     }
   }
 }
コード例 #2
0
ファイル: SignUtil.java プロジェクト: sk89q/CraftBook
 /**
  * If this blockstate is a sign.
  *
  * @param block The blockstate to check
  * @return If it is a sign
  */
 public static boolean isSign(BlockState block) {
   return block.getType() == BlockTypes.STANDING_SIGN || block.getType() == BlockTypes.WALL_SIGN;
 }