return getSafeSpawnPosition(new Vector3i(ChunkConstants.SIZE_X / 2, ChunkConstants.SIZE_Y / 2, ChunkConstants.SIZE_Z / 2));
}
private Vector3i getSafeSpawnPosition(Vector3i spawnPos) {
World world = worldGenerator.getWorld();
if (world != null) {
// try and find somewhere in this chunk a spot to land
Region worldRegion = world.getWorldData(Region3i.createFromMinAndSize(new Vector3i(0, 0, 0), ChunkConstants.CHUNK_SIZE));
SurfaceHeightFacet surfaceHeightFacet = worldRegion.getFacet(SurfaceHeightFacet.class);
SeaLevelFacet seaLevelFacet = worldRegion.getFacet(SeaLevelFacet.class);
int seaLevel = seaLevelFacet.getSeaLevel();
for (Vector3i pos : ChunkConstants.CHUNK_REGION) {