Search in sources :

Example 1 with RealisticBiomePatcher

use of rtg.world.biome.realistic.RealisticBiomePatcher in project Realistic-Terrain-Generation by Team-RTG.

the class VolcanoGenerator method rMapVolcanoes.

public void rMapVolcanoes(ChunkPrimer primer, World world, IBiomeProviderRTG cmr, int baseX, int baseY, int chunkX, int chunkY, OpenSimplexNoise simplex, CellNoise cell, float[] noise) {
    // Have volcanoes been disabled in the global config?
    if (!rtgConfig.ENABLE_VOLCANOES.get())
        return;
    // Let's go ahead and generate the volcano. Exciting!!! :D
    if (baseX % 4 == 0 && baseY % 4 == 0) {
        int biomeId = Biome.getIdForBiome(cmr.getBiomeGenAt(baseX * 16, baseY * 16));
        RealisticBiomeBase realisticBiome = getBiome(biomeId);
        // Do we need to patch the biome?
        if (realisticBiome == null) {
            RealisticBiomePatcher biomePatcher = new RealisticBiomePatcher();
            realisticBiome = biomePatcher.getPatchedRealisticBiome("NULL biome found when mapping volcanoes.");
        }
        if (!realisticBiome.getConfig().ALLOW_VOLCANOES.get())
            return;
        // Have volcanoes been disabled via frequency?
        // Use the global frequency unless the biome frequency has been explicitly set.
        int chance = realisticBiome.getConfig().VOLCANO_CHANCE.get() == -1 ? rtgConfig.VOLCANO_CHANCE.get() : realisticBiome.getConfig().VOLCANO_CHANCE.get();
        if (chance < 1)
            return;
        if (mapRand.nextInt(chance) > 0)
            return;
        float river = cmr.getRiverStrength(baseX * 16, baseY * 16) + 1f;
        if (river > 0.98f && cmr.isBorderlessAt(baseX * 16, baseY * 16)) {
            // we have to pull it out of noVolcano. We do it this way to avoid having to make a ChunkPos twice
            ChunkPos probe = new ChunkPos(baseX, baseY);
            noVolcano.remove(probe);
            long i1 = mapRand.nextLong() / 2L * 2L + 1L;
            long j1 = mapRand.nextLong() / 2L * 2L + 1L;
            mapRand.setSeed((long) chunkX * i1 + (long) chunkY * j1 ^ world.getSeed());
            WorldGenVolcano.build(primer, world, mapRand, baseX, baseY, chunkX, chunkY, simplex, cell, noise);
        }
    }
}
Also used : RealisticBiomePatcher(rtg.world.biome.realistic.RealisticBiomePatcher) RealisticBiomeBase(rtg.world.biome.realistic.RealisticBiomeBase) ChunkPos(net.minecraft.util.math.ChunkPos)

Aggregations

ChunkPos (net.minecraft.util.math.ChunkPos)1 RealisticBiomeBase (rtg.world.biome.realistic.RealisticBiomeBase)1 RealisticBiomePatcher (rtg.world.biome.realistic.RealisticBiomePatcher)1