Exemplo n.º 1
0
        public void rMapVolcanoes(Chunk 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)
            {
                return;
            }

            // Let's go ahead and generate the volcano. Exciting!!! :D
            if (baseX % 4 == 0 && baseY % 4 == 0)
            {
                int biomeId = cmr.getBiomeGenAt(baseX * 16, baseY * 16).getBiomeID();
                RealisticBiomeBase realisticBiome = RealisticBiomeBase.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)
                {
                    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 == -1 ? rtgConfig.VOLCANO_CHANCE : realisticBiome.getConfig().VOLCANO_CHANCE;
                if (chance < 1)
                {
                    return;
                }
                if (mapRand.Next(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.Next() / 2L * 2L + 1L;
                    long j1 = mapRand.Next() / 2L * 2L + 1L;
                    mapRand = new Random((int)((long)chunkX * i1 + (long)chunkY * j1 ^ world.getSeed()));

                    WorldGenVolcano.build(primer, world, mapRand, baseX, baseY, chunkX, chunkY, simplex, cell, noise);
                }
            }
        }
Exemplo n.º 2
0
        public BiomeProviderRTG(Texture2D world) : base(world)
        {
            //this.rtgWorld = new RTGWorld(world);
            this.biomesToSpawnIn   = new List <Biome>();
            this.borderNoise       = new float[256];
            this.biomePatcher      = new RealisticBiomePatcher();
            this.riverSeparation  /= RTGAPI.config().RIVER_FREQUENCY_MULTIPLIER;
            this.riverValleyLevel *= RTGAPI.config().riverSizeMultiplier();
            this.largeBendSize    *= RTGAPI.config().RIVER_BENDINESS_MULTIPLIER;
            this.smallBendSize    *= RTGAPI.config().RIVER_BENDINESS_MULTIPLIER;

            long seed = this.rtgWorld.world.getSeed();

            simplex = new OpenSimplexNoise(seed);
            cell    = new SimplexCellularNoise(seed);
            //simplexCell = new SimplexCellularNoise(seed);
            river = new VoronoiCellNoise(seed);
            testCellBorder();
        }