Ejemplo n.º 1
0
  @Override
  public byte[] generate(World world, Random random, int chunkX, int chunkZ) {
    Chunk chunk = new Chunk();

    // what type of road?
    boolean northsouth = chunkX % cityblocksize == 0;
    boolean eastwest = chunkZ % cityblocksize == 0;

    // underlayment
    chunk.setLayer(random, 0, Material.BEDROCK);

    // TODO Need to do something MUCH smarter
    // TODO Multiple width buildings

    // roads?
    if (northsouth || eastwest) {
      chunk.setStreet(world, random, citystreetat, northsouth, eastwest);

      // park? (about one per city block, on average)
    } else if (random.nextInt((cityblocksize - 1) * (cityblocksize - 1)) == 0) {
      chunk.setPark(world, random, citystreetat);

      // building...
    } else {
      chunk.setBuilding(world, random, citystreetat);
    }

    return chunk.blocks;
  }