Skip to content

Pack Making JSON GUI Text

SnailPerson edited this page Aug 10, 2026 · 5 revisions

GUI text objects are used to render text on the player’s screen rather than on the model itself. This can be used for cockpit hover prompts, switch descriptions, temporary instructions, status readouts, and similar on-screen information. Every entry in the guiTextObjects section is a GUI text object, and therefore you can have multiple objects for different things. For example, you may want to have one prompt appear when hovering a magneto switch, another when hovering a fuel selector, and a small status readout while seated in the pilot seat. GUI text objects are client-side only, only show for the relevant local player, and will hide when the player hides the GUI with F1.

See example below:

edwffewf.mov
Code Example
"guiTextObjects": [
  		{
    "pos": [0, -24, 0],
    "rot": [0, 0, 0],
    "scale": 1.0,
    "renderPosition": 0,
    "defaultText": "Starter",
    "color": "FFFFFF",
    "fadeInTime": 4,
    "fadeOutTime": 4,
    "animations": [
      {
        "animationType": "visibility",
        "variable": "engines_running",
        "clampMin": 0.0,
        "clampMax": 0.0
      },
      {
        "animationType": "visibility",
        "variable": "collision_11_player_cursor_hovered",
        "clampMin": 1.0,
        "clampMax": 1.0
      }
    ]
  },
  {
    "pos": [0, -24, 0],
    "rot": [0, 0, 0],
    "scale": 1.0,
    "renderPosition": 0,
    "defaultText": "Spotlight Switch",
    "color": "FFFFFF",
    "fadeInTime": 10,
    "fadeOutTime": 10,
    "animations": [
      {
        "animationType": "visibility",
        "variable": "collision_13_player_cursor_hovered",
        "clampMin": 1.0,
        "clampMax": 1.0
      }
    ]
  }
]

GUI text objects have the following parameters:

pos – An entry of x, y, and z coordinates that define where the text should render on the screen. Unlike normal text objects, these coordinates are in screen-space relative to the center of the screen. Positive X moves the text right, positive Y moves it down. Text may still be left or right aligned by specifying the proper parameter.

rot – An entry of x, y, and z rotations that tell MTS how to rotate this text on the screen.

scale – The scale of the text. For GUI text, 1.0 renders at the normal GUI text size rather than world/model size.

fieldName – An optional name for this text field. This is generally not needed for normal GUI prompts, but may be used if you want the GUI text to display the value of an existing editable text field with the same name.

variableName - If this is present, then this text field will be set to the value of this variable and will not be editable. Mainly useful for on-screen readouts, but may also be used for prompts that change state.

variableFactor - The factor to apply to the variable before formatting. Not used if the variable is text-based. If this is used, variableName and variableFormat MUST be used as well or it will have no effect.

variableFormat - The format to display the variable in. This follows the Java String.format() format, with the input being a floating-point number (%f) for normal variables, and a string (%s) for text variables. This has many different ways of formatting things. Google will be your friend here, this documentation shall not. (But this documentation will)

variableOffset - The amount to offset what the text object returns. Acts like animation offsets.

defaultText – The default text to display. This is the text the object will show if no variable is specified, or the fallback text if no matching field value is found. Required, but may be blank.

maxLength – The max number of characters this entry can have. This is generally not needed for GUI text unless you are intentionally sharing a value with a regular editable text object.

color – A Color Value. This tells MTS what color this text should be.

inheritedColorIndex – If set, then this text will get its color from the definition section’s secondColor parameter, if one exists for the specified index.

renderPosition – The mode for this text to render. Position 0 is centered text, with the text anchored at the top-center, position 1 is left-aligned, where pos is the top-left point of the text. Mode 2 is right-aligned, where pos is the top-right point.

autoScale – If true, this text will be auto-scaled to fit inside the wrapWidth rather than actually wrapping to another line. Has no effect unless you specify a wrapWidth!

wrapWidth – If this is set, the rendered text will automatically wrap once it hits this many pixels in width. Note that scaled text will still wrap based on the non-scaled pixel width, so adjust your wrapWidth accordingly if you’re scaling text.

fontName – An optional folder of a font to use for this field. If included, this text will be rendered with this font rather than the default font. Format is [packID:fontname]. Fonts are then named: assets/packID/textures/fonts/fontname/unicode_page_xx.png, where xx corresponds with the default font you are replacing. Note: The default unicode fonts for use as a template can be found in the base minecraft.jar in assets/minecraft/textures/font.

animations – An optional list of animations used to control when this text should appear. For GUI text, these are mainly intended for visibility logic rather than moving the text around. In most cases you will want to use visibility animations with variables such as player_cursor_hovered, collision_#_player_cursor_hovered, or collision_#_#_player_cursor_hovered. If all visibility conditions pass, the text will fade in. When they stop passing, the text will fade out.

fadeInTime – The time, in ticks, that this text takes to fade in after its animations return true. If not defined, this defaults to 7 ticks.

fadeOutTime – The time, in ticks, that this text takes to fade out after its animations stop returning true. If not defined, this defaults to 7 ticks.

GUI Text Objects displaying images

GUI Text Objects can also display images, textures or any form of imaginary. Additional parameters:

textureNames: List of texture paths to render instead of text. One texture remains static, multiple textures cycle every 20 ticks by default.

textureDelays: Optional list of display durations for entries in textureNames, similar to how particles work. Value in ticks. Faulty / missing entries default to 20 ticks.

Existing pos, rot, scale, animations, fadeInTime, and fadeOutTime also apply to textures. defaultText and color are not required when textureNames is present.

Clone this wiki locally