Yuebian's Transit Expansion (UTE)
MTR4 Train "Physicality" Expansion — Make trains a collidable wall that can knock you back, a roof you can stand on, and a shell that keeps rain out.
- Minecraft
1.20.1/ Fabric - Dependencies: Fabric API, MTR
4.0.x - Mod ID:
uteVersion:1.0.0License: MIT
MTR trains look fantastic as they run, but they are essentially "ghosts": you can walk straight through them, taking no damage when struck, and standing on the roof in the rain still leaves you soaked. UTE wraps each carriage with a collision shell fitted to the vehicle body, dealing 1–4 hearts of damage and knockback scaled by speed. It lets you stand on the roof and travel along with the train, and keeps both the roof and interior dry while rain continues to fall outside.
Motivation
MTR implements trains as models moving along schedules. These models do not participate in physics: no collision bounds, no mass, no weather awareness. This is fine for riding, but any interaction with the train outside the cabin quickly breaks immersion:
- Walking alongside the train, your player clips straight into the bodywork;
- Standing on the track and being hit head-on by a 72 km/h train leaves your health bar untouched;
- Climbing onto the roof of an observation car in the rain to sightsee, rain passes straight through you and into the cabin.
UTE fills these gaps, designed to feel native rather than tacked-on.
Features
① Fitted Collision: Carriages become solid
Thin bounding walls (thickness 0.35 blocks) are generated for each carriage, following the carriage’s position, rotation and curves. The interior volume is intentionally left hollow:
- Collision blocks you from the outside and prevents clipping;
- Normal boarding, movement and seating inside the carriage remain completely unaffected.
Collision handling runs client-side (player movement is client-authoritative), eliminating rubber-banding where you get pushed by the train only to be snapped back by the server.
② Consequences of Impact: 1–4 hearts damage + knockback scaled by speed
| Speed | Damage | Knockback |
|---|---|---|
| 2 m/s (~7 km/h) | 1 heart | Light push |
| 8 m/s (~29 km/h) | ~2 hearts | Noticeable recoil |
| 20 m/s (~72 km/h) | 4 hearts | Heavy launch |
- Damage and knockback are linearly interpolated between
minDamageSpeedandmaxDamageSpeed, not fixed values; - 1-second default cooldown to prevent repeated instant kills when pressed against the train;
- Impacts spawn sparks and smoke, and play a low thud sound (built-in, no resource pack required);
- Creative mode players are not damaged, but still get knocked back and see sparks/sound for debugging alignment;
- Passengers inside MTR carriages, riders on the roof and bystanders are never caught in friendly fire.
Hit detection uses swept volume testing (displacement over a tick), so a 72 km/h train will not miss collisions between sampling steps.
③ Standable Roofs
This is not an invisible chair seat. You stand physically on the roof plane:
- Free walking, sprinting, jumping and sneaking are supported;
- The roof frame rotates with the train through curves, so you do not slide outward on bends;
- Jumping preserves your motion relative to the train; you land back on the roof;
- Step off the edge and fall normally with no sticky lock.
Implementation: each tick the player is carried rigidly using the carriage’s transform (centre + rotation), anchored vertically at roof height. Uphill, downhill, turnout and reverse movement all work automatically, as it reads geometric state rather than velocity.
④ Rain Behaviour: Dry roofs and interiors, rain visible outside
This is often the feature that surprises users: rain only falls outside your window.
- Rain columns covered by the carriage roof are culled, keeping the roof surface and cabin interior dry;
- Adjacent rain columns outside the vehicle render normally according to terrain height, preserving a continuous rain view from inside;
- This implements occlusion masking instead of globally disabling weather.
If shaders or other weather-modifying mods override rain rendering and break masking, enable the fallback hideRainInsideCar (tradeoff: external rain also disappears).
⑤ Splash Effects: No interior drips, wheel spray at speed
Vanilla rain spawns impact splashes around the player. UTE suppresses splashes generated within the carriage bounds (stopping phantom raindrops inside the cabin), while spawning subtle wheel spray at rail contact height proportional to speed, simulating wheels rolling over standing water.
Adjust splashSpeedThreshold to reduce spray, or set strictNoSplash = true to disable it entirely.
⑥ Extra Details
- All systems share the same carriage geometry source. Collision shell height, roof plane, rain mask and splash positions stay aligned, avoiding mismatches like solid collision but leaking rain.
- MTR data access uses reflection bridging, with no compile-time dependency on MTR. Minor MTR updates do not require a new UTE release.
- Fault isolation: a failure in one subsystem disables only that module and logs a warning, without crashing the game loop.
Installation
- Install Fabric Loader 0.15+ and Fabric API for
1.20.1; - Install MTR 4.0.x (
4.0.0or newer, including patch releases); - Drop
ute-1.0.0.jarinto yourmods/folder; - Launch the game.
Required on both client and server. Roof riding, rain masking and collision blocking run client-side (determined by Minecraft’s movement model); damage, knockback and particle effects are server-authoritative. Single-player uses a combined process, so one installation suffices.
Configuration
Config file: config/ute.json (auto-generated on first launch. Run /ute reload after edits, no restart required).
| Key | Default | Description |
|---|---|---|
enableCollision |
true |
Enable fitted collision shells |
enableDamage |
true |
Enable impact damage and knockback |
enableRoofRiding |
true |
Enable standing on carriage roofs |
enableRainShelter |
true |
Enable rain occlusion for cabins and roofs |
enableSpeedSplash |
true |
Enable wheel spray splashes at speed |
minDamageSpeed / maxDamageSpeed |
2.0 / 20.0 |
Speed range for damage scaling (m/s, ~7 / 72 km/h) |
minDamage / maxDamage |
2.0 / 8.0 |
Damage range (health points; 8 = 4 hearts) |
minKnockback / maxKnockback |
0.45 / 1.35 |
Knockback strength range |
damageCooldownTicks |
20 |
Hit cooldown per entity (20 ticks = 1 second) |
shellThickness |
0.35 |
Collision shell thickness; smaller = tighter fit |
carHeight |
3.0 |
Base carriage height (roof height = floor + this value) |
rainRoofDry |
true |
true: fully dry roof; false: rain renders on roof surface |
hideRainInsideCar |
false |
Fallback: suppress all rain in masked area (outside rain also vanishes) |
strictNoSplash |
false |
Disable wheel spray entirely |
debug |
false |
Enable verbose logging |
For vehicles with non-standard heights, use carHeightOverrides to specify height per carriage type.
Commands
| Command | Function |
|---|---|
/ute status |
Self-check: count loaded trains, collision/rain mask status, hit counters |
/ute reload |
Reload configuration file |
/ute debug |
Toggle debug logging |
/ute panic |
Global emergency disable, revert all behaviour to vanilla |
Troubleshooting via /ute status: cars=0 means no carriages are detected; rainMasked=0 means rain masking failed (most often overridden by shaders); solidHits/impacts remain zero if no valid collisions have occurred.
Known Limitations
- Roof riding and rain masking are client-side features. On multiplayer servers, clients without UTE will not be carried on roofs and cannot see dry roof/cabin rain masking. This is a consequence of client-authoritative player positioning in Minecraft, not an implementation shortcut.
- Roofs have no true collision volume. The roof rider effect is positional anchoring, so blocks or ceilings directly above the roof do not interact with vanilla collision rules.
- Iris / OptiFine shaders replacing native weather rendering may break column-based rain masking; use
hideRainInsideCaras a fallback. - Default carriage height
3.0may require tuning viacarHeightOverridesfor some custom rolling stock.
License
MIT. May be included in modpacks, modified and redistributed with attribution.
Author: Yuebian Source: https://github.com/Yuebian-Studio/Yuebian-s-Transit-Expansion