Example #1
0
        public void PaintTerrain(ChunkColumn column, int i, int j, int x, int z, int depth,
                                 OverworldGeneratorV2 generator, float[] noise, float river, BiomeBase[] biomes)
        {
            float c     = TerrainBase.CalcCliff(x, z, noise);
            bool  cliff = c > 1.4f;

            for (int k = 255; k > -1; k--)
            {
                Block b = column.GetBlockObject(x, k, z);
                if (b is Air)
                {
                    depth = -1;
                }
                else if (b is Stone)
                {
                    depth++;

                    if (cliff)
                    {
                        if (depth > -1 && depth < 2)
                        {
                            if (_rnd.Next(3) == 0)
                            {
                                column.SetBlock(x, k, z, CliffCobbleBlock);
                            }
                            else
                            {
                                column.SetBlock(x, k, z, CliffStoneBlock);
                            }
                        }
                        else if (depth < 10)
                        {
                            column.SetBlock(x, k, z, CliffStoneBlock);
                        }
                    }
                    else
                    {
                        if (depth == 0 && k > 61)
                        {
                            column.SetBlock(x, k, z, TopBlock);
                        }
                        else if (depth < 4)
                        {
                            column.SetBlock(x, k, z, FillerBlock);
                        }
                    }
                }
            }
        }
Example #2
0
        /// <inheritdoc />
        public override void PaintTerrain(ChunkColumn column,
                                          int blockX,
                                          int blockZ,
                                          int x,
                                          int z,
                                          int depth,
                                          OverworldGeneratorV2 generator,
                                          float[] noise,
                                          float river,
                                          BiomeBase[] biomes)
        {
            FastRandom rand    = new FastRandom();
            var        simplex = generator.SimplexInstance(0);
            float      c       = TerrainBase.CalcCliff(x, z, noise);
            bool       cliff   = c > 1.4f;

            for (int y = 255; y > -1; y--)
            {
                Block b = column.GetBlockObject(x, y, z);
                if (b is Air)
                {
                    depth = -1;
                }
                else if (b is Stone)
                {
                    depth++;

                    if (cliff)
                    {
                        if (depth > -1 && depth < 2)
                        {
                            if (rand.Next(3) == 0)
                            {
                                column.SetBlock(x, y, z, CliffCobbleBlock);
                            }
                            else
                            {
                                column.SetBlock(x, y, z, CliffStoneBlock);
                            }
                        }
                        else if (depth < 10)
                        {
                            column.SetBlock(x, y, z, CliffStoneBlock);
                        }
                    }
                    else
                    {
                        if (depth == 0 && y > 61)
                        {
                            if (simplex.GetValue(blockX / width, blockZ / width) > height)                             // > 0.27f, i / 12f
                            {
                                column.SetBlock(x, y, z, mixBlock);
                            }
                            else
                            {
                                column.SetBlock(x, y, z, TopBlock);
                            }
                        }
                        else if (depth < 4)
                        {
                            column.SetBlock(x, y, z, FillerBlock);
                        }
                    }
                }
            }
        }
Example #3
0
        /// <inheritdoc />
        public override void PaintTerrain(ChunkColumn column,
                                          int blockX,
                                          int blockZ,
                                          int x,
                                          int z,
                                          int depth,
                                          OverworldGeneratorV2 generator,
                                          float[] noise,
                                          float river,
                                          BiomeBase[] biomes)
        {
            float c     = TerrainBase.CalcCliff(x, z, noise);
            bool  cliff = c > 1.3f;
            Block b;

            for (int k = 255; k > -1; k--)
            {
                b = column.GetBlockObject(x, k, z);
                if (b is Air)
                {
                    depth = -1;
                }
                else if (b is Stone)
                {
                    depth++;

                    if (cliff)
                    {
                        column.SetBlock(x, k, z, PlateauBlocks[k % PlateauBlocks.Length]);
                    }
                    else
                    {
                        if (k > 74 + grassRaise)
                        {
                            if (depth == 0)
                            {
                                if (Rnd.Next(5) == 0)
                                {
                                    column.SetBlock(x, k, z, mix2Block);
                                }
                                else
                                {
                                    column.SetBlock(x, k, z, TopBlock);
                                }
                            }
                            else if (depth < 4)
                            {
                                column.SetBlock(x, k, z, FillerBlock);
                            }
                        }
                        else if (depth == 0 && k > 61)
                        {
                            int r = (int)((k - (62 + grassRaise)) / 2f);
                            if (Rnd.Next(r + 2) == 0)
                            {
                                column.SetBlock(x, k, z, mixBlock);
                            }
                            else if (Rnd.Next((int)(r / 2f) + 2) == 0)
                            {
                                column.SetBlock(x, k, z, mix2Block);
                            }
                            else
                            {
                                column.SetBlock(x, k, z, TopBlock);
                            }
                        }
                        else if (depth < 4)
                        {
                            column.SetBlock(x, k, z, FillerBlock);
                        }
                    }
                }
            }
        }
Example #4
0
        /// <inheritdoc />
        public override void PaintTerrain(ChunkColumn column,
                                          int blockX,
                                          int blockZ,
                                          int x,
                                          int z,
                                          int depth,
                                          OverworldGeneratorV2 generator,
                                          float[] noise,
                                          float river,
                                          BiomeBase[] biomes)
        {
            var   simplex = generator.SimplexInstance(0);
            float p       = simplex.GetValue(blockX / 8f, blockZ / 8f) * 0.5f;
            float c       = TerrainBase.CalcCliff(x, z, noise);
            int   cliff   = 0;

            Block b;

            for (int y = 255; y > -1; y--)
            {
                b = column.GetBlockObject(x, y, z);
                if (b is Air)
                {
                    depth = -1;
                }
                else if (b is Stone)
                {
                    depth++;

                    if (depth == 0)
                    {
                        if (c > 0.45f && c > 1.5f - ((y - 60f) / 65f) + p)
                        {
                            cliff = 1;
                        }
                        if (c > 1.5f)
                        {
                            cliff = 2;
                        }
                        if (y > 110 + (p * 4) && c < 0.3f + ((y - 100f) / 50f) + p)
                        {
                            cliff = 3;
                        }

                        if (cliff == 1)
                        {
                            if (Rnd.Next(3) == 0)
                            {
                                column.SetBlock(x, y, z, CliffCobbleBlock);
                            }
                            else
                            {
                                column.SetBlock(x, y, z, CliffStoneBlock);
                            }
                        }
                        else if (cliff == 2)
                        {
                            column.SetBlock(x, y, z, ShadowStoneBlock);
                        }
                        else if (cliff == 3)
                        {
                            column.SetBlock(x, y, z, new Snow());
                        }
                        else if (simplex.GetValue(blockX / 50f, blockZ / 50f) + p * 0.6f > 0.24f)
                        {
                            column.SetBlock(x, y, z, MixBlock);
                        }
                        else
                        {
                            column.SetBlock(x, y, z, new Grass());
                        }
                    }
                    else if (depth < 6)
                    {
                        if (cliff == 1)
                        {
                            column.SetBlock(x, y, z, CliffStoneBlock);
                        }
                        else if (cliff == 2)
                        {
                            column.SetBlock(x, y, z, ShadowStoneBlock);
                        }
                        else if (cliff == 3)
                        {
                            column.SetBlock(x, y, z, new Snow());
                        }
                        else
                        {
                            column.SetBlock(x, y, z, new Dirt());
                        }
                    }
                }
            }
        }
Example #5
0
        public virtual void PaintTerrain(ChunkColumn column, int blockX, int blockZ, int x, int z, int depth,
                                         OverworldGeneratorV2 generator, float[] noise, float river, BiomeBase[] biomes)
        {
            // float c = TerrainBase.CalcCliff(x, z, noise);
            // bool cliff = c > 1.4f;

            for (int y = 255; y > -1; y--)
            {
                Block b = column.GetBlockObject(x, y, z);

                if (b is Air)
                {
                    depth = -1;
                }
                else if (b is Stone)
                {
                    depth++;

                    if (depth == 0 && y > generator.Preset.SeaLevel - 2)
                    {
                        column.SetBlock(x, y, z, TopBlock);
                    }
                    else if (depth < 4)
                    {
                        column.SetBlock(x, y, z, FillerBlock);
                    }
                }

                /*else if (b is Water && y >= generator.Preset.SeaLevel)
                 * {
                 *  if ((biomes[NoiseMap.GetIndex(x, z)].Type & BiomeType.Snowy) != 0)
                 *  {
                 *      column.SetBlock(x,y,z, new Ice());
                 *  }
                 * }*/
            }

            /*for (int y = 255; y > -1; y--) {
             *  Block b = column.GetBlockObject(x, y, z);
             *  if (b is Air) {
             *      depth = -1;
             *  }
             *  else if (b is Stone) {
             *      depth++;
             *
             *      if (cliff) {
             *          if (depth > -1 && depth < 2) {
             *              if (Rnd.Next(3) == 0) {
             *
             *                  column.SetBlock(x, y, z, CliffCobbleBlock);
             *              }
             *              else {
             *
             *                  column.SetBlock(x, y, z, CliffStoneBlock);
             *              }
             *          }
             *          else if (depth < 10) {
             *              column.SetBlock(x, y, z, CliffStoneBlock);
             *          }
             *      }
             *      else {
             *          if (depth == 0 && y > 61) {
             *              column.SetBlock(x, y, z, TopBlock);
             *          }
             *          else if (depth < 4) {
             *              column.SetBlock(x, y, z, FillerBlock);
             *          }
             *      }
             *  }
             * }*/
        }
        /// <inheritdoc />
        public override void PaintTerrain(ChunkColumn column,
                                          int blockX,
                                          int blockZ,
                                          int x,
                                          int z,
                                          int depth,
                                          OverworldGeneratorV2 generator,
                                          float[] noise,
                                          float river,
                                          BiomeBase[] biomes)
        {
            var   simplex = generator.SimplexInstance(0);
            float c       = TerrainBase.CalcCliff(x, z, noise);
            int   cliff   = 0;
            bool  m       = false;

            Block b;

            for (int k = 255; k > -1; k--)
            {
                b = column.GetBlockObject(x, k, z);

                if (b is Air)
                {
                    depth = -1;
                }
                else if (b is Stone)
                {
                    depth++;

                    if (depth == 0)
                    {
                        float p = simplex.GetValue(blockX / 8f, blockZ / 8f, k / 8f) * 0.5f;

                        if (c > min && c > sCliff - ((k - sHeight) / sStrength) + p)
                        {
                            cliff = 1;
                        }

                        if (c > cCliff)
                        {
                            cliff = 2;
                        }

                        if (cliff == 1)
                        {
                            if (Rnd.Next(3) == 0)
                            {
                                column.SetBlock(x, k, z, CliffCobbleBlock);
                            }
                            else
                            {
                                column.SetBlock(x, k, z, CliffStoneBlock);
                            }
                        }
                        else if (cliff == 2)
                        {
                            column.SetBlock(x, k, z, ShadowStoneBlock);
                        }
                        else if (k < 63)
                        {
                            if (k < 62)
                            {
                                column.SetBlock(x, k, z, FillerBlock);
                            }
                            else
                            {
                                column.SetBlock(x, k, z, TopBlock);
                            }
                        }
                        else if (simplex.GetValue(blockX / 12f, blockZ / 12f) > mixHeight)
                        {
                            column.SetBlock(x, k, z, mixBlock);
                            m = true;
                        }
                        else
                        {
                            column.SetBlock(x, k, z, TopBlock);
                        }
                    }
                    else if (depth < 6)
                    {
                        if (cliff == 1)
                        {
                            column.SetBlock(x, k, z, CliffStoneBlock);
                        }
                        else if (cliff == 2)
                        {
                            column.SetBlock(x, k, z, ShadowStoneBlock);
                        }
                        else
                        {
                            column.SetBlock(x, k, z, FillerBlock);
                        }
                    }
                }
            }
        }