Promote sparse spawn facets to a higher precedence
@@ -58,12 +58,12 @@ protected Vector3f findSpawnPosition(World world, Vector2i pos, int searchRadius
SurfaceHeightFacet surfaceHeightFacet = worldRegion.getFacet(SurfaceHeightFacet.class);
SpawnHeightFacet spawnHeightFacet = worldRegion.getFacet(SpawnHeightFacet.class);
- if (surfaceHeightFacet != null) {
- getWorld = v -> Optional.of(surfaceHeightFacet.getWorld(v.getX(), v.getY()));
- }
- else if (spawnHeightFacet != null) {
+ if (spawnHeightFacet != null) {
getWorld = v -> spawnHeightFacet.getWorld(v.getX(), v.getY());
}
+ else if (surfaceHeightFacet != null) {
+ getWorld = v -> Optional.of(surfaceHeightFacet.getWorld(v.getX(), v.getY()));
+ }
else {
throw new IllegalStateException("Surface height facet and spawn height facet not found");
}
@@ -73,12 +73,12 @@ else if (spawnHeightFacet != null) {
SeaLevelFacet seaLevelFacet = worldRegion.getFacet(SeaLevelFacet.class);
StrictlySparseSeaLevelFacet sparseSeaLevelFacet = worldRegion.getFacet(StrictlySparseSeaLevelFacet.class);
- if (seaLevelFacet != null) {
- getSeaLevel = v -> Optional.of(seaLevelFacet.getSeaLevel());
- }
- else if (sparseSeaLevelFacet != null) {
+ if (sparseSeaLevelFacet != null) {
getSeaLevel = v -> sparseSeaLevelFacet.getSeaLevel(v.getX(), v.getY());
}
+ else if (seaLevelFacet != null) {
+ getSeaLevel = v -> Optional.of(seaLevelFacet.getSeaLevel());
+ }
else {
getSeaLevel = v -> Optional.of(0);
}
