コード例 #1
0
  static {
    SHIELD_BASE.setFrequency(0.01);
    SHIELD_BASE.setNoiseQuality(NoiseQuality.STANDARD);
    SHIELD_BASE.setOctaveCount(1);

    SHIELD.SetSourceModule(0, SHIELD_BASE);
    SHIELD.setFrequency(0.05);
    SHIELD.setPower(10);
    SHIELD.setRoughness(3);
  }
コード例 #2
0
ファイル: EndStoneBiome.java プロジェクト: nallar/Vanilla
 public EndStoneBiome(int biomeId) {
   super(biomeId, new SpireDecorator());
   base.setNoiseQuality(NoiseQuality.BEST);
   base.setOctaveCount(4);
   base.setFrequency(0.1);
   base.setPersistence(0.10);
   base.setLacunarity(0.4);
   noise.SetSourceModule(0, base);
   noise.setFrequency(0.2);
   noise.setRoughness(2);
   noise.setPower(0.3);
 }
コード例 #3
0
ファイル: DesertBiome.java プロジェクト: sir-maniac/Vanilla
 public DesertBiome(int biomeId) {
   super(
       biomeId,
       new CactusDecorator(),
       new OreDecorator(),
       new CaveDecorator(),
       new DungeonDecorator());
   base.setNoiseQuality(NoiseQuality.BEST);
   base.setOctaveCount(6);
   base.setFrequency(0.3);
   base.setPersistence(0.12);
   base.setLacunarity(0.5);
   noise.SetSourceModule(0, base);
   noise.setFrequency(0.3);
   noise.setRoughness(2);
   noise.setPower(0.5);
 }
コード例 #4
0
ファイル: EndStoneBiome.java プロジェクト: nallar/Vanilla
  @Override
  public void generateColumn(CuboidShortBuffer blockData, int x, int chunkY, int z) {
    base.setSeed((int) blockData.getWorld().getSeed());
    noise.setSeed((int) blockData.getWorld().getSeed());
    int y = chunkY * 16;
    double seaLevel = 60.0;
    double perlinRange = 0.005;
    double colSize = 16.0;
    int height =
        (int)
            ((noise.GetValue(x / colSize + perlinRange, 0.05, z / colSize + perlinRange) + 1.0)
                    * 4.0
                + seaLevel);

    for (int dy = y; dy < y + 16; dy++) {
      blockData.set(x, dy, z, getBlockId(height, dy));
    }
  }
コード例 #5
0
 @Override
 public void populate(Chunk chunk, Random random) {
   if (chunk.getY() != 4) {
     return;
   }
   final int size = Chunk.BLOCKS.SIZE;
   final int x = chunk.getBlockX();
   final int z = chunk.getBlockZ();
   final World world = chunk.getWorld();
   final int seed = (int) (world.getSeed() * 73);
   SHIELD_BASE.setSeed(seed);
   SHIELD.setSeed(seed);
   final double[][] noise = WorldGeneratorUtils.fastNoise(SHIELD, size, size, 4, x, 63, z);
   for (int xx = 0; xx < size; xx++) {
     for (int zz = 0; zz < size; zz++) {
       if (noise[xx][zz] > 0.92) {
         final int y = world.getSurfaceHeight(x + xx, z + zz);
         for (int yy = 0; yy >= -7; yy--) {
           if (yy == 0) {
             final Block block = world.getBlock(x + xx, y + yy, z + zz, world);
             if (!canReplace(block.getMaterial())) {
               continue;
             }
             block.setMaterial(
                 block.getY() <= NormalGenerator.SEA_LEVEL
                     ? VanillaMaterials.STATIONARY_WATER
                     : VanillaMaterials.AIR);
           } else {
             if (canReplace(world.getBlockMaterial(x + xx, y + yy, z + zz))) {
               world.setBlockMaterial(
                   x + xx, y + yy, z + zz, VanillaMaterials.STONE, (short) 0, world);
             }
           }
         }
       }
     }
   }
 }
コード例 #6
0
  static {
    ELEVATION.setFrequency(0.2);
    ELEVATION.setLacunarity(1);
    ELEVATION.setNoiseQuality(NoiseQuality.STANDARD);
    ELEVATION.setPersistence(0.7);
    ELEVATION.setOctaveCount(1);

    ROUGHNESS.setFrequency(0.53);
    ROUGHNESS.setLacunarity(1);
    ROUGHNESS.setNoiseQuality(NoiseQuality.STANDARD);
    ROUGHNESS.setPersistence(0.9);
    ROUGHNESS.setOctaveCount(1);

    DETAIL.setFrequency(0.7);
    DETAIL.setLacunarity(1);
    DETAIL.setNoiseQuality(NoiseQuality.STANDARD);
    DETAIL.setPersistence(0.7);
    DETAIL.setOctaveCount(1);

    final Multiply multiply = new Multiply();
    multiply.SetSourceModule(0, ROUGHNESS);
    multiply.SetSourceModule(1, DETAIL);

    final Add add = new Add();
    add.SetSourceModule(0, multiply);
    add.SetSourceModule(1, ELEVATION);

    SCALE.SetSourceModule(0, add);
    SCALE.setxScale(0.06);
    SCALE.setyScale(0.06);
    SCALE.setzScale(0.06);

    TURBULENCE.SetSourceModule(0, SCALE);
    TURBULENCE.setFrequency(0.01);
    TURBULENCE.setPower(8);
    TURBULENCE.setRoughness(1);

    FINAL.SetSourceModule(0, SCALE);
    FINAL.setLowerBound(-1);
    FINAL.setUpperBound(1);

    int height = 0;
    for (VanillaBiome biome : VanillaBiomes.getBiomes()) {
      if (!(biome instanceof NormalBiome)) {
        continue;
      }
      height = Math.max(height, (int) Math.ceil(((NormalBiome) biome).getMax()));
    }
    HEIGHT = (++height / 4) * 4 + 4;
  }
コード例 #7
0
 @Override
 protected void generateTerrain(
     CuboidShortBuffer blockData, int x, int y, int z, BiomeManager biomes, long seed) {
   if (y >= HEIGHT) {
     return;
   }
   final Vector3 size = blockData.getSize();
   final int sizeX = size.getFloorX();
   final int sizeY = MathHelper.clamp(size.getFloorY(), 0, HEIGHT);
   final int sizeZ = size.getFloorZ();
   ELEVATION.setSeed((int) seed * 23);
   ROUGHNESS.setSeed((int) seed * 29);
   DETAIL.setSeed((int) seed * 17);
   TURBULENCE.setSeed((int) seed * 53);
   final Random random = WorldGeneratorUtils.getRandom(seed, x, y, z, 6516);
   final double[][][] noise =
       WorldGeneratorUtils.fastNoise(FINAL, sizeX, sizeY, sizeZ, 4, x, y, z);
   final BiomeSelector selector = getSelector();
   final TIntPairObjectHashMap<NormalBiome> biomeCache = new TIntPairObjectHashMap<NormalBiome>();
   for (int xx = 0; xx < sizeX; xx++) {
     for (int zz = 0; zz < sizeZ; zz++) {
       float maxSum = 0;
       float minSum = 0;
       byte count = 0;
       for (int sx = -SMOOTH_SIZE; sx <= SMOOTH_SIZE; sx++) {
         for (int sz = -SMOOTH_SIZE; sz <= SMOOTH_SIZE; sz++) {
           final NormalBiome adjacent;
           if (xx + sx < 0 || zz + sz < 0 || xx + sx >= sizeX || zz + sz >= sizeZ) {
             if (biomeCache.containsKey(x + xx + sx, z + zz + sz)) {
               adjacent = biomeCache.get(x + xx + sx, z + zz + sz);
             } else {
               adjacent = (NormalBiome) selector.pickBiome(x + xx + sx, y, z + zz + sz, seed);
               biomeCache.put(x + xx + sx, z + zz + sz, adjacent);
             }
           } else {
             adjacent = (NormalBiome) biomes.getBiome(xx + sx, y, zz + sz);
           }
           minSum += adjacent.getMin();
           maxSum += adjacent.getMax();
           count++;
         }
       }
       final double minElevation = minSum / count;
       final double smoothHeight = (maxSum / count - minElevation) / 2d;
       for (int yy = 0; yy < sizeY; yy++) {
         double noiseValue =
             noise[xx][yy][zz] - 1 / smoothHeight * (y + yy - smoothHeight - minElevation);
         if (noiseValue >= 0) {
           blockData.set(x + xx, y + yy, z + zz, VanillaMaterials.STONE.getId());
         } else {
           if (y + yy <= SEA_LEVEL) {
             if (y + yy == SEA_LEVEL
                 && ((NormalBiome) biomes.getBiome(xx, 0, zz)).getClimate() == Climate.COLD) {
               blockData.set(x + xx, y + yy, z + zz, VanillaMaterials.ICE.getId());
             } else {
               blockData.set(x + xx, y + yy, z + zz, VanillaMaterials.WATER.getId());
             }
           } else {
             blockData.set(x + xx, y + yy, z + zz, VanillaMaterials.AIR.getId());
           }
         }
       }
       if (y == 0) {
         final byte bedrockDepth = (byte) (random.nextInt(BEDROCK_DEPTH) + 1);
         for (byte yy = 0; yy < bedrockDepth; yy++) {
           blockData.set(x + xx, yy, z + zz, VanillaMaterials.BEDROCK.getId());
         }
       }
     }
   }
 }