Repository navigation
Feature Settings and Speed
Two knobs on every train — rolling-window carriage count and target speed — are now editable from an in-game settings screen and persisted per-world. The speed value also has its own OP command for quick runtime tweaks.
Accessed via Esc → Mods → Dungeon Train → Config (Forge's Mods menu registers the button automatically). Two fields:
| Field | Range | Default |
|---|---|---|
| Carriages | [1, 50] |
5 |
| Speed (m/s) | [0.0, 20.0] |
2.0 |
| Train Y | [-64, 320] |
78 |
Clicking Save:
- Writes the new values to the current world's ServerConfig toml file.
- Iterates every active
TrainTransformProviderand callssetTargetVelocity/setCounton the integrated server. Live trains accelerate/decelerate immediately and the window resizes on the next tick (if a player is within 128 blocks — see the rolling-window range filter).
Clicking Cancel returns without saving. Out-of-range values are silently clamped on save.
/dungeontrain speed 0.5 # 0.5 m/s, visibly slow
/dungeontrain speed 20.0 # max
Sets the target speed, persists it to the world's ServerConfig, and applies it to every active Dungeon Train in every server level. Responds with Train speed set to <value> m/s (<N> active train(s) updated).
Values are stored as a Forge ServerConfig at:
saves/<world>/serverconfig/dungeontrain-server.toml
[train]
numCarriages = 5
speed = 2.0
trainY = 78Each world has its own file — changing speed in World A does not affect World B. The file is written atomically on every Save / /dungeontrain speed invocation.
-
DungeonTrainConfig.java— theForgeConfigSpec+ safe accessors (returns defaults when spec is unloaded, e.g. title screen before any world is opened) -
DungeonTrainSettingsScreen.java— theScreenwith twoEditBoxwidgets and Save/Cancel buttons -
TrainCommand.java—spawn+speedBrigadier subcommands, all defaults sourced fromDungeonTrainConfig
- Carriage-count changes need a nearby player to take effect (see the rolling-window range filter). The saved value is authoritative, but visible carriages only update when a player comes within 128 blocks of the ship.
-
Settings screen live-update only runs on the integrated server. A dedicated-server client opening Esc → Mods → Config will see and edit the values, but the live-update call finds no trains because
Minecraft.getInstance().getSingleplayerServer()returns null. The/dungeontrain speedcommand works from a dedicated server console. -
Direction is still hardcoded to +X. Speed is just a scalar multiplier on the velocity vector
(speed, 0, 0).