Skip to content

Feature World Creation Options

Brennan Hatton edited this page Apr 23, 2026 · 2 revisions

Per-world train toggle + Y at world creation

Since: v0.17.0 — PR #23

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.

Usage

  1. Singleplayer → Create New World → World tab — a new "Dungeon Train Options…" button sits as a row beneath Bonus Chest.

  2. Clicking it opens a small sub-screen with two controls:

    Field Default Range
    Starts with train (checkbox) checked —
    Train Y (integer) 78 [-64, 320]
  3. Done captures the values into a static client-side holder; Cancel returns without changing them.

  4. Click Create New World. On integrated-server start, the choices are committed to the world's data/dungeontrain_world.dat file. TrainBootstrapEvents (at ServerStartedEvent with EventPriority.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.

Persistence

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

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).

Files

Known limitations

  • 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 .dat file (it's vanilla NBT — open with NBTExplorer or similar). The in-game Esc → Mods → Dungeon Train → Config still shows the TOML trainY, 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.

Clone this wiki locally