This is an old revision of the document!
Table of Contents
Adding Custom Resources
User-created content can be added to the Minecraft Transit Railway mod via resource packs. Currently, players can add the following:
- Texture variants for existing trains
- New textures or text for railway signs
It is highly recommended to be familiar with creating a resource pack before proceeding with this guide.
Resource Pack Format
The file mtr_custom_resources.json
is the main file that will get loaded. This file defines custom content for the mod to register. It must be placed under the mtr
namespace; in other words, it must have the file path of assets/mtr/mtr_custom_resources.json
.
Adding Texture Variants for Existing Trains
To add texture variants, the custom_trains
JSON object should be added to mtr_custom_resouces.json
. Each JSON object under custom_trains
, representing a texture variant for a train, should have a unique key and serveral required entries.
Key | Data Type | Description | Notes |
---|---|---|---|
name | String | The name to be shown on dashboards when selecting trains for a route | Required |
color | String (colour hex code) | The colour to be shown on dashboards when selecting trains for a route | Optional, defaults to the colour black if none specified |
base_train_type | String (train ID) | The train model to apply the texture on | Required(If bbmodel is not used.), see the trains page for a list of train identifiers |
texture_id | String (texture ID) | The namespaced ID of the texture file | Required |
description | String | A brief description of this train can be added. Newline code (\n) available. | Optional |
wikipedia_article | String | You can cite the English Wikipedia article. If it is too long, it will be omitted in the middle. | Optional |
train_barrier_id | String | Train barriers will be installed at the end of the car. If not specified, it will not be displayed. | Optional |
gangway_connection_id | String | Gangway will be placed at the end of the car. If not specified, a Gangway of SP1900 will be shown. | Optional |
has_gangway_connection | Boolean | Selects whether the gangway can be passed through if false, the gangway will be transparent and the gangway_connection_id specification will be ignored. | Optional, Default is true (can pass through) |
door_animation_type | String | The following door animations can be specified. Must be written in CAPITAL LETTERS. STANDARD STANDARD_SLOW CONSTANT PLUG_FAST PLUG_SLOW BOUNCY_1 BOUNCY_2 MLR R179 R211 | Optional, Default is set to the door animation specified by train ID, if BBmodel is used, it is set to the STANDARD (SP1900) animation. CONSTANT only 32 (max) regardless of train door width. |
model | String | Specify BBmodel file by file path. | Required if BBmodel is used. If set, base_train_type should not be described. |
model_properties | String | Specify Model Properties file(.json) by file path. | Required if BBmodel is used. If set, base_train_type should not be described. |
speed_sound_base_id | String | Specifies the ID of a conventional running sound, which can be either the default train ID or one defined in sounds.json. | Optional, If not specified, the sound will be silent. |
speed_sound_count | Number | Specify the number of ogg files in the acceleration or deceleration folder within the folder specified in speed_sound_base_id above. If not specified correctly, files above a certain speed will be silent. | Optional, If not set, the number of sounds specified by Train ID is set. |
door_sound_base_id | String | Specifies the ID of a conventional door sound, which can be either the default train ID or one defined in sounds.json. | Optional, If not specified, the sound will be silent. |
door_close_sound_time | Number | Specifies the offset of the door sound; cannot be greater than 1 or less than 0 due to limitations on the MTR side. | Optional, Default is 0.5 |
bve_sound_base_id | String | Specifies the ID of a BVE sound, which can be either the default train ID or one defined in sounds.json. See here for how it is defined. MTR:Custom_BVE_Train_Sound | Optional, If specified, conventional format sound will not be available. |
An example is shown below.
{ "custom_trains": { "my_custom_train": { "name": "My Custom SP1900 Train", "color": "FEC5E5", "base_train_type": "sp1900", "texture_id": "mtr:custom_directory/custom_sp1900.png" } } }
Adding New Railway Sign Textures or Text
To add new railway signs textures or text, the custom_signs
JSON object should be added to mtr_custom_resouces.json
. Each JSON object under custom_signs
, representing a new sign, should have a unique key and serveral required entries.
Key | Data Type | Description | Notes |
---|---|---|---|
texture_id | String (texture ID) | The namespaced ID of the texture file | Required |
flip_texture | Boolean | If true , the texture will be flipped horizontally | Optional |
custom_text | String | If set, the text will be shown to the right of the image; the pipe character \| is supported, for example 客務中心\|Customer Service Centre | Optional |
flip_custom_text | Boolean | If custom_text is set and flip_custom_text is true , the text will be shown to the left of the image | Optional |
small | Boolean | If true , the image will be rendered with a margin around it | Optional |
background_color | String (colour hex code) | The colour for the backgound | Optional, defaults to the colour black if none specified |
An example is shown below.
{ "custom_signs": { "my_custom_sign": { "texture_id": "mtr:custom_directory/custom_sign.png", "flip_texture": false, "custom_text": "你好|Hello", "flip_custom_text": false, "small": true, "background_color": "1167B1" } } }
Verifying the Resource Pack
Use a JSON validator to check for any syntax errors of the JSON files.
The resource pack (zip file) can be installed either clientside or as a server resource pack. If installed as a server resource pack, all players joining the server will be able to see the new additions after accepting the server resource pack.
Download the example resource pack to see a full example and to test out the functionality.