public override void OnGenerateBlock(long x, long y, long z, BlockData outBlock) { if (isFlatland) { if (x < -10 || x > 10 || z < -10 || z > 10) { outBlock.block = Example.Air; } else { if (x == 0 && z == 5 && y == 46) { //outBlock.block = Example.Wildcard; //OnTree(x, y, z, outBlock); } if (x == 5 && z == 5 && y == 45) { outBlock.block = Example.IronOre; } else if (y == 45) { outBlock.block = Example.Grass; } else if (y == 44) { outBlock.block = Example.Dirt; } else { //outBlock.block = Example.Wildcard; } } return; } float elevation = GetElevation(outBlock.x, outBlock.y, outBlock.z); //if (y <= 0) //{ // outBlock.block = BlockValue.STONE; //} long elevationL = (long)Math.Round(elevation); long elevationAbove = (long)Math.Round(GetElevation(x, y + 1, z)); if (y >= elevationL) { if (y < seaLevel) { outBlock.block = Example.WaterNoFlow; } else { outBlock.block = Example.Wildcard; } } else { long distFromSurface = elevationL - y; long aboveDistFromSurface = elevationAbove - (y + 1); bool topInAir = aboveDistFromSurface <= 0; if (topInAir) { outBlock.block = Example.Grass; // low pr of making tree if (Simplex.Noise.rand(x, y, z) < 0.01f) { if (Simplex.Noise.rand(x * 2 + 1, y, z) < 0.9f) { //SetBlock(x, y + 1, z, Example.FlowerWithNectar); } else { } } else if (false) { } } else if (distFromSurface < 3) { outBlock.block = Example.Dirt; } else if (distFromSurface < 5) { outBlock.block = Example.Clay; } else { float lavaCaveDepth = outBlock.GetChunkProperty(lavaProp); if (y > bedrockMax) { float rVal = Simplex.Noise.rand(x, y, z); if (rVal < 0.9 && distFromSurface == 5) { outBlock.block = Example.LooseRocks; } else if (rVal < 0.5 && distFromSurface == 6) { outBlock.block = Example.LooseRocks; } else if (rVal < 0.2 && distFromSurface == 7) { outBlock.block = Example.LooseRocks; } else if (rVal < 0.04) { outBlock.block = Example.LooseRocks; } else { outBlock.block = Example.Stone; } if (outBlock.block == Example.LooseRocks) { outBlock.state = (int)System.Math.Round(Simplex.Noise.rand(x * 3, y * 5, z * 6) * 2.0f + 1.0f); } else if (outBlock.block == Example.Stone) { int numRocks = (int)System.Math.Round(Simplex.Noise.rand(x * 3, y * 5, z * 6) * 2.0f + 1.0f); int numLargeRocks = (int)System.Math.Round(Simplex.Noise.rand(x * 3, y * 2, z * 3) * 2.0f + 1.0f); outBlock.state = numRocks + numLargeRocks * 6; } } else { if (y >= bedrockMin && y <= bedrockMax) { long distFromEdge = System.Math.Min(System.Math.Abs(bedrockMin - y), System.Math.Abs(bedrockMax - y)); if (distFromEdge < 3 && Simplex.Noise.rand(x, y, z) < 0.2) { outBlock.block = Example.Air; } else { outBlock.block = Example.Bedrock; } } else if (y < lavaCaveDepth) { outBlock.block = Example.Lava; } else { outBlock.block = Example.Wildcard; } } } } }