Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Spawn level: Add 'get_spawn_level(x, z)' API #7104
Spawn level: Add 'get_spawn_level(x, z)' API
Returns a suitable player spawn y co-ordinate for unmodified terrain.
This returns the value calculated by the existing
"Returns a player spawn y co-ordinate for the provided (x, z) co-ordinates,
Tested with this mod:
Enable fly and fly slightly above the terrain to avoid being inside the placed stone, the stone will appear 2 nodes above ground level, this matches the level the engine calculates and is intentional to cope with full-node biome dust nodes so that a player does not spawn waist deep in a snowblock.
rubenwardy, 'mapgen height' is unsuitable because this returns the value calculated by 'getSpawnLevelAtPoint()' in each mapgen. These functions return a spawn level that is slightly above the terrain to cope with full-node biome dust nodes, and they only return a spawn level if the level is within a certain range. So the value is very much to do with spawning not terrain height.