コード例 #1
0
  @Override
  public void postGenerateChunk(
      WorldGenerator generator, PlatLot lot, ByteChunk chunk, CachedYs blockYs) {
    OreProvider ores = generator.oreProvider;
    int lotBottomY = lot.getBottomY(generator);
    if (lotBottomY != 0) {

      // shape the underworld
      if (lot.style == LotStyle.STRUCTURE || lot.style == LotStyle.ROAD) {
        for (int x = 0; x < chunk.width; x++) {
          for (int z = 0; z < chunk.width; z++) {
            if (odds.playOdds(underworldOdds)) {
              int y = lotBottomY - odds.getRandomInt(underworldLength);
              if (!chunk.isEmpty(x, lotBottomY, z))
                chunk.setBlocks(x, y, lotBottomY, z, ores.subsurfaceId);
            }
          }
        }
      }

      // cross beams
      chunk.setBlocks(7, 9, lotBottomY - 2, lotBottomY, 0, 16, stoneId);
      chunk.setBlocks(0, 16, lotBottomY - 2, lotBottomY, 7, 9, stoneId);
    }
  }
コード例 #2
0
  @Override
  public void preGenerateChunk(
      WorldGenerator generator, PlatLot lot, ByteChunk chunk, BiomeGrid biomes, CachedYs blockYs) {
    Biome resultBiome = lot.getChunkBiome();
    OreProvider ores = generator.oreProvider;

    // shape the world
    for (int x = 0; x < chunk.width; x++) {
      for (int z = 0; z < chunk.width; z++) {
        if (generator.settings.includeFloatingSubsurface) {

          // where is the ground?
          int groundY = findGroundY(generator, chunk.getBlockX(x), chunk.getBlockZ(z));

          // make the base
          chunk.setBlock(x, 0, z, ores.substratumId);

          // place the way down there bits
          chunk.setBlocks(x, 1, groundY - 1, z, ores.stratumId);

          // seas?
          if (groundY < seaLevel) {
            chunk.setBlock(x, groundY - 1, z, ores.fluidSubsurfaceId);
            chunk.setBlock(x, groundY, z, ores.fluidSurfaceId);
            if (generator.settings.includeAbovegroundFluids) {
              if (generator.settings.includeDecayedNature)
                chunk.setBlocks(x, groundY + 1, deepSeaLevel, z, ores.fluidId);
              else chunk.setBlocks(x, groundY + 1, seaLevel, z, ores.fluidId);
            }
          } else {
            chunk.setBlock(x, groundY - 1, z, ores.subsurfaceId);
            chunk.setBlock(x, groundY, z, ores.surfaceId);
          }
        }

        // set biome for block
        biomes.setBiome(x, z, generator.oreProvider.remapBiome(resultBiome));
      }
    }
  }
コード例 #3
0
 @Override
 public void postGenerateBlocks(
     WorldGenerator generator, PlatLot lot, RealChunk chunk, CachedYs blockYs) {
   // there is always something to plant!
   lot.generateSurface(generator, chunk, true);
 }