Pack Making JSON Text - DonBruce64/MinecraftTransportSimulator GitHub Wiki
Text objects are used to render text on models. This can be used for license plates on cars, tail numbers on planes, status information on fuel pumps, etc. Every entry in the text
section is a text object, and therefore you can have multiple objects for different things. For example, you may want to make a bus with light-up route signs with multiple characters, but also with two license plates that are limited to 7 characters. Text objects have the following parameters:
- pos – An entry of x, y, and z coordinates that define the center point of where the text should render. Text may 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. By default all text faces +z, on the model.
- scale – The scale of the text. 1.0 will render text about ½ block high, as 1 text character pixel equates to one block texture pixel, and text is 8-pixels high. Note: For custom fonts the entire square will be 1/2 block high with a scale of 1.
- fieldName – The name for this text field. If two text fields share a name, then they both will be combined in the text GUI into one entry, and changing the text in the GUI will affect both of them. Useful for license plates and route signs.
- 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 instruments, but may be used on 3D models if desired.
- 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 what the field will have when the model is first placed down, and will persist until a player changes it. Required, but may be blank.
- maxLength – The max number of characters this entry can have.
- 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.
- attachedTo – If set, this text will be assumed to be part of the specified Animated Model Object, and will offset itself to always be in the same position relative to the object. Useful for text on doors, trunks, or anything else that moves.
- lightsUp – If true, then this text will light up when the model is lit up.
- 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.
NOTE: Font png files can be divided in a grid with even squares with it's supposed symbol.