Add WIP plains biome

This commit is contained in:
UnknownShadow200 2023-02-17 22:08:34 +11:00
parent 3a5a544ff5
commit ec60e0117d
2 changed files with 18 additions and 4 deletions

View File

@ -22,7 +22,7 @@ namespace MCGalaxy.Generator
{ {
public enum MapGenBiomeName public enum MapGenBiomeName
{ {
Forest, Arctic, Desert, Hell, Swamp, Mine, Sandy Forest, Arctic, Desert, Hell, Swamp, Mine, Sandy, Plains
} }
/// <summary> Contains environment settings and the types of blocks that are used to generate a map </summary> /// <summary> Contains environment settings and the types of blocks that are used to generate a map </summary>
@ -61,6 +61,7 @@ namespace MCGalaxy.Generator
case MapGenBiomeName.Swamp: return Swamp; case MapGenBiomeName.Swamp: return Swamp;
case MapGenBiomeName.Mine: return Mine; case MapGenBiomeName.Mine: return Mine;
case MapGenBiomeName.Sandy: return Sandy; case MapGenBiomeName.Sandy: return Sandy;
case MapGenBiomeName.Plains: return Plains;
} }
return Forest; return Forest;
} }
@ -170,5 +171,18 @@ namespace MCGalaxy.Generator
Border = Block.Sand, Border = Block.Sand,
TreeType = "Palm", TreeType = "Palm",
}; };
public static MapGenBiome Plains = new MapGenBiome()
{
Surface = Block.Grass,
Ground = Block.Dirt,
Cliff = Block.Stone,
Water = Block.Air,
Bedrock = Block.Stone,
BeachSandy = Block.Grass,
BeachRocky = Block.Grass,
TreeType = "", // "use default for generator"
Horizon = Block.Grass,
};
} }
} }

View File

@ -58,6 +58,7 @@ namespace MCGalaxy.Generator.fCraft {
bCliff = biome.Cliff; bCliff = biome.Cliff;
args.AddWater = biome.Water != Block.Air; args.AddWater = biome.Water != Block.Air;
args.AddTrees = biome.TreeType != null;
// TODO: temp hack, need a better solution // TODO: temp hack, need a better solution
if (args.Biome == MapGenBiomeName.Arctic) groundThickness = 1; if (args.Biome == MapGenBiomeName.Arctic) groundThickness = 1;
@ -351,8 +352,8 @@ namespace MCGalaxy.Generator.fCraft {
if( (map.GetBlock( (ushort)nx, (ushort)ny, (ushort)nz ) == bGroundSurface) && slopemap[nx * length + nz] < .5 ) { if( (map.GetBlock( (ushort)nx, (ushort)ny, (ushort)nz ) == bGroundSurface) && slopemap[nx * length + nz] < .5 ) {
// Pick a random height for the tree between Min and Max, // Pick a random height for the tree between Min and Max,
// discarding this tree if it would breach the top of the map // discarding this tree if it would breach the top of the map
int nh; int nh = rn.Next( minHeight, maxHeight + 1 );
if( (nh = rn.Next( minHeight, maxHeight + 1 )) + ny + nh / 2 > map.Height ) if( ny + nh + nh / 2 > map.Height )
continue; continue;
// Generate the trunk of the tree // Generate the trunk of the tree
@ -413,7 +414,6 @@ namespace MCGalaxy.Generator.fCraft {
args.SnowAltitude = (int)Math.Round(args.SnowAltitude * ratio); args.SnowAltitude = (int)Math.Round(args.SnowAltitude * ratio);
args.Biome = theme; args.Biome = theme;
args.AddTrees = theme == MapGenBiomeName.Forest;
args.WaterLevel = (lvl.Height - 1) / 2; args.WaterLevel = (lvl.Height - 1) / 2;
new fCraftMapGen(args).Generate(lvl); new fCraftMapGen(args).Generate(lvl);