/** * 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); } } } } } }
/** * 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; }