Repository navigation
Feature World Creation Options
Promotes the auto-spawn behavior and trainY from server-wide TOML config to per-world choices made on the Create World screen. Each world records its own values; changing the choice in one world doesn't affect any other.
-
Singleplayer → Create New World → World tab — a new "Dungeon Train Options…" button sits as a row beneath Bonus Chest.
-
Clicking it opens a small sub-screen with two controls:
Field Default Range Starts with train (checkbox) checked — Train Y (integer) 78[-64, 320] -
Done captures the values into a static client-side holder; Cancel returns without changing them.
-
Click Create New World. On integrated-server start, the choices are committed to the world's
data/dungeontrain_world.datfile.TrainBootstrapEvents(atServerStartedEventwithEventPriority.LOW, so the commit runs first) reads the values and either auto-assembles a train at the chosen Y or skips assembly entirely — all before any player joins. Since v0.27.0, login-time auto-spawn has been replaced by server-start assembly.
Applies to ALL world types — vanilla, Dungeon Train preset, custom — not just our preset.
Values live in a Forge SavedData file:
saves/<world>/data/dungeontrain_world.dat
NBT shape:
CompoundTag {
"trainY": int,
"startsWithTrain": boolean
}
The file is created on first integrated-server start after world creation. Worlds created before v0.17.0 have no file — the loader falls back to DungeonTrainConfig.getTrainY() (the existing TOML value) and defaults startsWithTrain to true, so legacy worlds preserve the operator's tuned TOML. The fallback values are written to disk on the next save.
Dedicated servers never show the Create World UI. The entire WorldLifecycleEvents class is Dist.CLIENT-gated, so it isn't loaded on a dedicated server. The dungeontrain_world.dat loader returns the TOML defaults unchanged, preserving the dedicated-server admin's existing workflow (edit dungeontrain-server.toml before first launch).
-
DungeonTrainWorldData.java— the ForgeSavedDatasubclass -
CreateWorldScreenMixin.java—@InjectintoCreateWorldScreen$WorldTab.<init>that adds the button row (see Compatibility § CreateWorldScreen$WorldTab inner-class mixin via LocalCapture) -
DungeonTrainOptionsScreen.java— the sub-screen -
PendingWorldChoices.java— client-only static holder -
WorldLifecycleEvents.java—ServerStartedEventhandler (NORMAL priority) that commits the holder into SavedData -
TrainBootstrapEvents.java—ServerStartedEventhandler (LOW priority) that reads the SavedData and assembles the starter train (since v0.27.0) -
PlayerJoinEvents.java— onPlayerLoggedInEvent, places the player alongside any existing train; no-op if no train exists
-
No in-game editor for live worlds. Once a world is created, the values are baked into
dungeontrain_world.dat. Changing the toggle or Y for an existing world means hand-editing the.datfile (it's vanilla NBT — open with NBTExplorer or similar). The in-game Esc → Mods → Dungeon Train → Config still shows the TOMLtrainY, but that value is now only consulted as a fallback default for legacy worlds. -
Toggle gates the auto-spawn path only. If a train already exists in the world (saved across reloads, manually placed, or via
/dungeontrain spawn), the toggle has no effect — players are still teleported alongside the existing train on login. -
Sub-screen choices are not pre-filled from the SavedData of any existing world — the holder defaults to
(true, 78)on each fresh Create World screen open. Only matters if you want to "copy" settings between worlds; for now, re-enter them.