From 85aef7f40459bb06b453948381d26705210b88c5 Mon Sep 17 00:00:00 2001 From: jack Date: Fri, 19 Feb 2016 16:37:45 -0800 Subject: [PATCH] Add water and sand to advanced generators. Changed 2d for loop set for advanced generation. --- Levels/Generator/MapGen.cs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Levels/Generator/MapGen.cs b/Levels/Generator/MapGen.cs index 66a4b87b7..57598de6f 100644 --- a/Levels/Generator/MapGen.cs +++ b/Levels/Generator/MapGen.cs @@ -166,8 +166,24 @@ namespace MCGalaxy { for (int z = 0; z < length; ++z) for (int x = 0; x < width; ++x) { - int height2D = (int)System.Math.Floor((module2D.GetValue(x / 100.0, 0.1, z / 100.0) + 2) * 10) + (half - 10); - lvl.SetTile((ushort)x, (ushort)height2D, (ushort)z, Block.grass); + int waterlvl = half - 1; + int height2D = (int)System.Math.Floor((module2D.GetValue(x / 100.0, 0.1, z / 100.0) + 2) * 10) + (half-20); + int height2Dtex01 = (int)System.Math.Floor((module2D.GetValue(x / 100.0, 0.1, z / 100.0) + 2) * 15) + (half- 30); + if (height2D < height2Dtex01) + { + lvl.SetTile((ushort)x, (ushort)(height2D), (ushort)z, Block.grass); + } + else + { + lvl.SetTile((ushort)x, (ushort)(height2D), (ushort)z, Block.sand); + } + if (height2D < waterlvl) + { + for (int y = waterlvl; y >= height2D; y--) + { + lvl.SetTile((ushort)x, (ushort)y, (ushort)z, Block.water); + } + } for (int y = height2D - 1; y >= 0; y--) { byte block = (y > height2D * 3 / 4) ? Block.dirt : Block.rock; lvl.SetTile((ushort)x, (ushort)y, (ushort)z, block);