protected override void InitSeed(int seed)
        {
            Simplex = new SimplexOctaveGenerator(seed, 1);
            Simplex.SetScale(1.5);

            Rnd = new FastRandom(seed);
        }
Exemple #2
0
        private void PopulateChunk(ChunkColumn chunk)
        {
            var bottom = new SimplexOctaveGenerator(Globals.Seed.GetHashCode(), 8);
            var top    = new SimplexOctaveGenerator(Globals.Seed.GetHashCode(), 8);

            bottom.SetScale(1 / Groundscale);
            top.SetScale(1 / Topscale);

            for (var x = 0; x < 16; x++)
            {
                for (var z = 0; z < 16; z++)
                {
                    float ox = x + chunk.X * 16;
                    float oz = z + chunk.Z * 16;

                    var bottomHeight =
                        (int)((bottom.Noise(ox, oz, BottomsFrequency, BottomsAmplitude) * BottomsMagnitude) + BottomOffset);
                    var topHeight = (int)((top.Noise(ox, oz, TopFrequency, TopAmplitude) * TopMagnitude) + TopOffset);

                    for (var y = 0; y < 256; y++)
                    {
                        if (y == 0 || y == 255)
                        {
                            chunk.SetBlock(x, y, z, BlockFactory.GetBlockById(7));
                            continue;
                        }

                        if (y < bottomHeight)
                        {
                            chunk.SetBlock(x, y, z, new BlockNetherrack());
                        }

                        if (y < topHeight)
                        {
                            chunk.SetBlock(x, 256 - y, z, new BlockNetherrack());
                            if (GetRandomNumber(1, 50) == 25)
                            {
                                chunk.SetBlock(x, 256 - (y + 1), z, new Block(89));
                            }
                        }
                    }

                    //Turn the blocks ontop into the correct material
                    for (var y = bottomHeight; y < 254; y++)
                    {
                        if (chunk.GetBlock(x, y + 1, z) == 0 && chunk.GetBlock(x, y, z) == 1)
                        {
                            chunk.SetBlock(x, y, z, new BlockNetherrack());

                            chunk.SetBlock(x, y - 1, z, new BlockNetherrack());
                            chunk.SetBlock(x, y - 2, z, new BlockNetherrack());
                        }
                    }
                }
            }

            new NetherLavaDecorator().Decorate(chunk, new PlainsBiome());
        }
Exemple #3
0
 public BiomeManager(int seed)
 {
     _octaveGeneratorb = new SimplexOctaveGenerator(seed, 1);
     _octaveGeneratorb.SetScale(1 / 512.0);
 }
Exemple #4
0
 public BiomeManager(int seed)
 {
     _octaveGeneratorb = new SimplexOctaveGenerator(seed, 1);
     _octaveGeneratorb.SetScale(1/512.0);
 }