public RealisticBiomePatcher()
        {
            this.patchBiomeId = rtgConfig.PATCH_BIOME_ID;

            if (this.patchBiomeId > -1)
            {
                try
                {
                    this.realisticBiome = RealisticBiomeBase.getBiome(this.patchBiomeId);
                }
                catch (Exception e)
                {
                    throw new Exception("Realistic patch biome " + this.patchBiomeId + " not found. Please make sure this biome is enabled.");
                }

                try
                {
                    this.baseBiome = realisticBiome.baseBiome;
                }
                catch (Exception e)
                {
                    throw new Exception("Base patch biome " + this.patchBiomeId + " not found. Please make sure this biome is enabled.");
                }
            }
        }
Beispiel #2
0
        public void rMapVolcanoes(Chunk primer, World world, IBiomeProviderRTG cmr, Random mapRand, 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;
            }

            // Have volcanoes been disabled in the biome config?
            int biomeId = cmr.getBiomeGenAt(baseX * 16, baseY * 16).getBiomeID();
            RealisticBiomeBase realisticBiome = getBiome(biomeId);

            // Do we need to patch the biome?
            if (realisticBiome == null)
            {
                RealisticBiomePatcher biomePatcher = new RealisticBiomePatcher();
                realisticBiome = biomePatcher.getPatchedRealisticBiome(
                    "NULL biome (" + biomeId + ") 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 we've made it this far, let's go ahead and generate the volcano. Exciting!!! :D
            if (baseX % 4 == 0 && baseY % 4 == 0 && mapRand.Next(chance) == 0)
            {
                float river = cmr.getRiverStrength(baseX * 16, baseY * 16) + 1f;
                if (river > 0.98f && cmr.isBorderlessAt(baseX * 16, baseY * 16))
                {
                    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);
                }
            }
        }