Links
Tags
Creators
Details
1.1.0
Compatibility
Changes
Create Train Web API 1.1.0
Highlights
- Much more train information: speed, destination, schedule, passengers, owner and more
- Live signal states, occupied signal blocks and upcoming arrivals per station
- Train cargo on request
- Config switches to choose which information the API collects and returns
- The BlueMap overlay (
train.js) now lives in this repository and gained clickable trains, stations and portals
New
API
/trainsand/trainsLivenow include speed, target speed and max speed, derailment, number of passengers, owner name, train icon, Create's map colour index, the network id, navigation (destination, distance, waiting at a signal), schedule (title, current stop, state, paused/completed, wait reason) and the planned route./networknow includes each network with the colour Create assigns it, the network id on nodes, edges and stations, track length and material per edge, signals, the signal block sections of every edge, and pairs of nodes linked through portals./statusand/statusLive(new, updated every second): occupied and reserved signal blocks, signal states, and for each station the train at the platform, the arriving train and the next arrivals. Arrival times come from the same predictions Create's display boards use; Create updates them every 5 seconds./cargo?train=<id>(new): items and fluids per carriage, computed only when requested./features(new): which optional data is enabled (see below).
Config: optional data
A new [data] section turns optional information on or off: owner, trainStatus, passengers, navigation, schedule, route, stationArrivals, signals, portals, cargo. Everything is on by default. Disabled data is not collected at all, which saves work on the server, and appears as null in the answers. Changes apply without a restart.
- NeoForge / Forge:
config/createtrainwebapi-common.toml - Fabric:
config/createtrainwebapi.toml(existing files without the section keep everything on)
BlueMap overlay
- Click a train for its speed (blocks/s), destination and distance, signal wait time, schedule, passengers and cargo.
- Click a station for the train at the platform and the next arrivals with a countdown.
- Click a portal to jump to the map of the other dimension at the portal's position.
- New layers: stations & portals, signal lights, occupied signal blocks.
- Tracks are drawn in the colour Create gives each network.
- Menu entries are now switches that show their state and are remembered in the browser. By default, track lines and "trains through terrain" are off.
- Anything disabled in the API's config is hidden automatically.
Changes
- All data is now read from Create on the server thread and cached (trains every 200 ms, status every second, network every 5 s). Requests never touch the game state directly, which avoids errors from reading Create's data while the server is changing it.
- Existing JSON fields are unchanged; the new data is added alongside, so existing clients keep working.
Fixes
stoppedandbackwardswere alwaysfalse.- Train names came out as
literal{…}instead of the plain name. - A single carriage with missing data no longer breaks the whole
/trainsanswer. - Overlay: while a train passed through a portal, its cars could show the wrong model or position.
Upgrading
The overlay script moved from BluemapCreateEntityAddon to this repository, and the API does not serve it:
- Copy train.js into BlueMap's webroot (e.g.
bluemap/web/). - Set
hostat the top of the file to the address of the API as seen from the browser. If BlueMap is served over https, the API must be reachable over https too. - Add
"./train.js"toscriptsin BlueMap'swebapp.conf.
Projects on Modrinth are automatically available through a Maven repository for use with JVM build tools such as Gradle. To learn more about the Modrinth Maven API, click here.
Note: When available, you should use the creator's maven repo instead as it will have transitive dependency information that the Modrinth Maven API does not. You may also end up with duplicate dependencies if you use a mix of Modrinth and non-Modrinth Maven repositories for your dependencies, because the group identifier will be different when served through the Modrinth Maven API.
Maven coordinates:
Version ID:
build.gradle:
repositories {
exclusiveContent {
forRepository {
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}
}
// forRepositories(fg.repository) // Uncomment when using ForgeGradle
filter {
includeGroup "maven.modrinth"
}
}
}
// Standard Gradle dependency
dependencies {
implementation "maven.modrinth:blbzcN8G:fuJG7F8M"
}
// Legacy Loom dependency
dependencies {
modImplementation "maven.modrinth:blbzcN8G:fuJG7F8M"
}
