Skip to content

Commit

Permalink
fix: Wrap spawn point world generation in a phase
Browse files Browse the repository at this point in the history
  • Loading branch information
gabizou committed May 5, 2024
1 parent ff4eb11 commit 89eee23
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,10 @@ private ServerLevel prepareWorld(final ServerLevel world) {
final boolean hasSpawnAlready = levelDataBridge.bridge$customSpawnPosition();
if (!hasSpawnAlready) {
if (isDefaultWorld || levelDataBridge.bridge$performsSpawnLogic()) {
MinecraftServerAccessor.invoker$setInitialSpawn(world, levelData, levelData.worldGenOptions().generateBonusChest(), isDebugGeneration);
try (final var state = GenerationPhase.State.TERRAIN_GENERATION.createPhaseContext(PhaseTracker.getInstance())) {
state.buildAndSwitch();
MinecraftServerAccessor.invoker$setInitialSpawn(world, levelData, levelData.worldGenOptions().generateBonusChest(), isDebugGeneration);
}
} else if (Level.END.equals(world.dimension())) {
levelData.setSpawn(ServerLevel.END_SPAWN_POINT, 0);
}
Expand Down

0 comments on commit 89eee23

Please sign in to comment.