BetterRailwaySystem
BetterRailwaySystem 是一款适用于 Minecraft 的 Fabric 模组,它在保留原版矿车和轨道系统的基础上对其进行增强。
目标很简单:
- 完全兼容原版铁轨、动力铁轨、探测铁轨、激活铁轨以及红石行为
- 增强矿车的移动、操作、车站处理和线路管理
- 避免引入像 MTR 那样的独立铁路系统
当前范围
本模组基于原版矿车实体和原版轨道网络构建。
已实现的功能领域:
- 增强原版矿车的物理效果和操控性
- 用于生成、停靠、收集和广播的操作型铁路方块
- 世界线路记录与线路地图可视化
- 游戏内配置、命令及应答器资源管理
功能
矿车行为
- 在动力铁轨上平滑加速,而非瞬间达到最高速度
- 在无动力的动力铁轨上平滑减速,而非立即急停
- 可配置的
maxSpeed(最大速度)、acceleration(加速度)和 deceleration(减速度),单位为每秒方塊数
- 可配置同轨道路径后方矿车的安全跟车距离以实现自动制动
- 临时阻塞或反弹后自动恢复并重新加速
- 基于子步的高速铁路移动,以提高弯道和坡度的稳定性
- 针对原版铁轨上的动量保持进行坡度与高速移动调优
- 列车运行时加载矿车所在区块
- 无人看管的矿车在可配置的超时后自动消失
- 禁用矿车对实体的碰撞和推动行为以减少交通拥堵
- 大幅降低原版矿车轨道摩擦声至几乎听不见
多乘客矿车
- 默认情况下,一辆矿车最多可承载
24 名玩家
- 所有玩家共享同一个原版矿车实体
- 每位玩家保持正常的本地第一人称和第三人称渲染
- 同一辆矿车内的其他乘客被隐藏,以避免玩家模型重叠
- 保留原版的下矿车流程
铁路应答器 (Balise)
railway_balise 方块是一种用于操作事件的轨道侧触发方块。
支持的应答器模式:
arrival(到达)
departure(出发)
announcement(广播)
speed_limit_start(限速开始)
speed_limit_end(限速结束)
应答器行为包括:
- 仅向当前矿车乘客发送标题和副标题广播
- 仅向矿车乘客播放自定义音频
- 仅向矿车乘客显示自定义 HUD 图像
- 可选的图像持久化,直到下一个应答器出现或玩家离开矿车
- 更新当前车站和下一车站状态
- 可选的车内乘客老板条 (Bossbar) 更新
- 临时线路限速,支持可配置的限速开始和结束标记
停车铁轨 (Stop Rail)
stop_rail 方块作为精确车站停靠控制的轨道侧停车控制方块。
支持的行为:
- 可配置的停车距离
- 可配置的停靠时间
- 等待模式:
immediate(立即)、timer(计时器)、redstone(红石)
- 释放后自动重启,包括短暂的发射助推,以防止矿车卡住
列车生成器 (Train Spawner)
train_spawner 方块可以在现有的原版铁轨上自动生成矿车。
支持的设置:
- 城市名称
- 线路 ID
- 线路主题色
- 生成方向
- 基于间隔的发车调度
- 红石控制发车
- 环线标志
生成器行为:
- 仅在方块处或上方存在有效铁轨时生成
- 如果生成区域已被其他矿车占用,则拒绝生成
- 按照配置或检测到的铁轨方向自动发射矿车
- 将生成的矿车绑定到城市、线路、颜色、路线记录和环线状态
- 强制加载生成器所在的区块
列车收集器 (Train Collector)
train_collector 方块作为线路末端的回收点。
支持的行为:
- 当矿车到达收集器时移除矿车
- 在移除列车前,将访问过的车站记录到保存的铁路线路地图中
- 保存线路颜色和车站坐标以及车站顺序
铁路地图与线路地图
模组包含车内线路地图和世界铁路地图视图。
支持的行为:
- 使用反引号键
` / ~ 打开地图
- 乘坐时打开当前线路地图
- 未乘坐时打开世界铁路地图
- 按城市分组线路
- 通过同一城市中共享的车站名称合并换乘站
- 在线路地图和老板条中显示线路主题色
- 车站搜索
- 鼠标滚轮缩放
- 拖拽平移导航
- 显示包含车站名称、城市、线路列表和保存坐标的车站工具提示
- 每座城市提供线路颜色查找图例
- 从配置屏幕清除所有数据、单个城市或单条线路的铁路地图清除操作
老板条与线路主题
- 车内乘客的当前车站和下一车站老板条
- 老板条颜色跟随线路主题色
- 线路主题色也被保存的线路数据和地图渲染复用
应答器资源库
可以通过游戏内的库 UI 管理自定义应答器媒体。
支持的行为:
- 图片库
- 声音库
- 上传新的
.png 图片和 .ogg 声音
- 点击预览媒体
- 直接将媒体标识符选择到应答器编辑器中
- 为上传的资源自动生成并重新加载本地资源包
配置
可用的配置值包括:
maxSpeed(最大速度)
acceleration(加速度)
deceleration(减速度)
safeFollowingDistance(安全跟车距离)
maxPassengers(最大乘客数)
stopRailApproachDistance(停车铁轨接近距离)
unattendedDespawnSeconds(无人看管消失秒数)
可通过以下方式访问配置:
- 游戏内配置界面
- 命令:
/betterrailwaysystem config show、/betterrailwaysystem config reload、/betterrailwaysystem config set <key> <value>
环境要求
- Minecraft
1.21.1
- Fabric Loader
- Fabric API
- Yarn 映射
- Java
21
开发
常用命令:
./gradlew build
./gradlew runClient
项目结构
源码布局:
src/main/java/org/dcstudio/minecart 矿车运行时逻辑
src/main/java/org/dcstudio/renderer 客户端 UI 和覆盖层渲染
src/main/java/org/dcstudio/network 客户端/服务器数据载荷与同步
src/main/java/org/dcstudio/station 铁路方块与方块实体逻辑
src/main/java/org/dcstudio/config 配置与命令处理
说明
- 模组 ID 为
betterrailwaysystem。
- 所有自定义行为均基于原版铁轨设计,而非替换它们。
- 该模组兼容原版的动力铁轨、探测铁轨、激活铁轨和普通铁轨。
- 列车运行、车站事件和地图录制等功能均构建于原版矿车之上。
许可
本仓库采用 GPL-3.0 许可证授权。详见 LICENSE。
图标中 3D 模型的作者:Mareon,khj008008
BetterRailwaySystem
BetterRailwaySystem is a Fabric mod for Minecraft that enhances the vanilla minecart and rail system without replacing it.
The goal is simple:
- keep full compatibility with vanilla rails, powered rails, detector rails, activator rails, and redstone behavior
- enhance minecart movement, operation, station handling, and line management
- avoid introducing a separate railway system like MTR
Current Scope
This mod is built around the vanilla minecart entity and vanilla track network.
Implemented feature areas:
- enhanced vanilla minecart physics and control
- operational railway blocks for spawning, stopping, collecting, and announcing
- world line recording and line map visualization
- in-game configuration, commands, and balise asset management
Features
Minecart Behavior
- smooth acceleration on powered rails instead of instantly jumping to top speed
- smooth deceleration on unpowered powered rails instead of immediate hard stop
- configurable
maxSpeed, acceleration, and deceleration in blocks per second
- configurable safe following distance for automatic braking behind a minecart on the same track path
- automatic recovery and re-acceleration after temporary blocking or rebound
- substep-based high-speed rail movement to improve curve and slope stability
- slope and high-speed movement tuning focused on keeping momentum on vanilla rails
- minecart chunk loading while the train is running
- unattended minecart auto-despawn after a configurable timeout
- minecart collision and push behavior against entities disabled to reduce traffic jams
- vanilla minecart rail friction sound reduced to nearly inaudible
Multi-Passenger Minecart
- one minecart can carry up to
24 players by default
- all players share the same vanilla minecart entity
- each player keeps normal local first-person and third-person rendering
- other passengers in the same minecart are hidden to avoid player model overlap
- vanilla dismount flow is preserved
Railway Balise
The railway_balise block is a rail-side trigger block for operational events.
Supported balise modes:
arrival
departure
announcement
speed_limit_start
speed_limit_end
Balise behavior includes:
- sending title and subtitle announcements to current minecart passengers only
- playing custom audio to minecart passengers only
- showing a custom HUD image to minecart passengers only
- optional image persistence until the next balise or until the player leaves the minecart
- updating current station and next station state
- optional bossbar updates for onboard passengers
- temporary line speed limits with configurable speed limit start and end markers
Stop Rail
The stop_rail block works as a rail-side stop control block for precise station stopping.
Supported behavior:
- configurable stop distance
- configurable dwell time
- wait modes:
immediate, timer, redstone
- automatic restart after release, including a short launch boost so the minecart does not remain stuck
Train Spawner
The train_spawner block can automatically create minecarts on existing vanilla rails.
Supported settings:
- city name
- line id
- line theme color
- spawn direction
- interval-based dispatch
- redstone-controlled dispatch
- circular line flag
Spawner behavior:
- spawns only when a valid rail exists at or above the block
- refuses to spawn if another minecart is already occupying the spawn area
- launches the minecart automatically in the configured or detected rail direction
- binds spawned minecarts to city, line, color, route recording, and circular-line state
- forces the spawner chunk to stay loaded
Train Collector
The train_collector block acts as the end-of-line recovery point.
Supported behavior:
- removes the minecart when it reaches the collector
- records visited stations into the saved railway line map before removing the train
- saves line color and station coordinates along with station order
Railway Map and Line Map
The mod includes both onboard line maps and world railway map views.
Supported behavior:
- open the map with the grave accent key
` / ~
- open the current line map while riding
- open the world railway map while not riding
- city-based grouping of lines
- station transfer merging by shared station name within the same city
- line theme colors shown in the map and bossbar
- station search
- mouse wheel zoom
- drag-to-pan navigation
- station tooltip display with station name, city, line list, and saved coordinates
- per-city legends for line color lookup
- railway map clear actions for all data, one city, or one line from the config screen
Bossbar and Line Theme
- current station and next station bossbar for onboard passengers
- bossbar color follows the line theme color
- line theme color is also reused by saved line data and map rendering
Balise Asset Library
Custom balise media can be managed from the in-game library UI.
Supported behavior:
- image library
- sound library
- upload new
.png images and .ogg sounds
- click-to-preview media
- select a media identifier directly into the balise editor
- automatic local resource pack generation and reload for uploaded assets
Configuration
Available config values include:
maxSpeed
acceleration
deceleration
safeFollowingDistance
maxPassengers
stopRailApproachDistance
unattendedDespawnSeconds
Configuration is available through:
- in-game config screen
- commands:
/betterrailwaysystem config show, /betterrailwaysystem config reload, /betterrailwaysystem config set <key> <value>
Environment
- Minecraft
1.21.1
- Fabric Loader
- Fabric API
- Yarn mappings
- Java
21
Development
Common commands:
./gradlew build
./gradlew runClient
Project Structure
Source layout:
src/main/java/org/dcstudio/minecart minecart runtime logic
src/main/java/org/dcstudio/renderer client UI and overlay rendering
src/main/java/org/dcstudio/network client/server payloads and sync
src/main/java/org/dcstudio/station railway block and block entity logic
src/main/java/org/dcstudio/config config and command handling
Notes
- The mod id is
betterrailwaysystem.
- All custom behavior is designed around vanilla rails instead of replacing them.
- The mod keeps compatibility with vanilla powered rails, detector rails, activator rails, and normal rails.
- Train operation, station events, and map recording are all built on top of vanilla minecarts.
License
This repository is licensed under GPL-3.0. See LICENSE.
Author of the 3D model in the icon:Mareon,khj008008
评论 0
登录后参与评分
还没有评论,来抢沙发吧