-
Notifications
You must be signed in to change notification settings - Fork 4
Splicing Table Iota Rendering
HexDebug includes a custom data-driven system for customizing how iotas are rendered in the Splicing Table, which is documented on this page.
To set the renderer for an iota type {namespace}:{path}, a file must be added to a resource pack at assets/{namespace}/hexdebug_splicing_iotas/{path}.json. If this file does not exist, the fallback renderer will be used.
An iota renderer JSON file must, at a minimum, include a type or parent key. If both are present, type is always ignored and taken from the parent. The type field is a string containing the ID of a registered renderer (more on that later). The parent field is a string containing the ID of another iota type to inherit the renderer of (ie. "parent": "{namespace}:{path}" inherits from assets/{namespace}/hexdebug_splicing_iotas/{path}.json). Which fields are inherited depends on the implementation of the specific iota renderer in use.
All other fields in the file depend on the specific iota renderer being used.
A splicing table iota renderer consists of three parts: a parser, a provider, and a renderer. The parser (gay.object.hexdebug.api.client.splicing.SplicingTableIotaRendererParser) is used to parse iota definition files with a type field matching that parser's ID, outputting a provider; the provider (gay.object.hexdebug.api.client.splicing.SplicingTableIotaRendererProvider) is used to create renderers/tooltips and choose the background type when the splicing table needs to change which iotas are visible; and the renderer (gay.object.hexdebug.api.client.splicing.SplicingTableIotaRenderer) is called each frame to render the iota that it was created for.
To register a custom renderer, call the static method gay.object.hexdebug.api.client.splicing.SplicingTableIotaRenderers#register in your mod's client initializer with an ID and an iota renderer parser. The ID should have your modid as the namespace, and may have any arbitrary path.
The method SplicingTableIotaRendererParser#parse is called for each JSON file that has your parser's ID in its type field, or the type field of its parent. This method is passed the raw JsonObject, and the fully initialized parent object (if any). The parser is responsible for copying any missing values from the parent; HexDebug will not do this for you.
A texture renderer hardcoded to use the hexdebug:builtin/list icon. Uses the gold background type. Expects an iota with a ListTag as its data value, and adds an advanced tooltip with the list's length.
| Field | Type | Description | Default |
|---|---|---|---|
type |
string | hexdebug:list |
N/A |
Renders a pattern iota using Hex Casting's built-in renderer. Uses the slate background type. Expects an iota with a serialized HexPattern as its data value, and adds an advanced tooltip with the pattern's angle signature.
| Field | Type | Description | Default |
|---|---|---|---|
type |
string | hexdebug:pattern |
N/A |
Renders an arbitrary texture from a resource pack. Uses the gold background type.
| Field | Type | Description | Default |
|---|---|---|---|
type |
string | hexdebug:texture |
N/A |
texture |
string | Path to the texture file to use. Example: hexdebug:textures/gui/splicing_table.png
|
N/A |
xOffset |
int | Horizontal distance to offset the texture by when rendering over the button background. | 0 |
yOffset |
int | Vertical distance to offset the texture by when rendering over the button background. | 0 |
uOffset |
int | Horizontal position of the texture in the given file. | 0 |
vOffset |
int | Vertical position of the texture in the given file. | 0 |
width |
int | Width of the texture to render. | 18 |
height |
int | Height of the texture to render. | 21 |
textureWidth |
int | Total width of the given file. | 18 |
textureHeight |
int | Total height of the given file. | 21 |
useIotaColor |
bool | If true, tint the rendered texture using the color() method of the iota's type. |
true |
HexDebug includes several built-in icons, based on the hexdebug:texture renderer, that you can use as-is for your own iotas if you wish. To use any of these, your iota definition file should look like this:
{
"parent": "hexdebug:builtin/{name}"
}For example:
{
"parent": "hexdebug:builtin/type"
}The full list of built-in icons is as follows:
hexdebug:builtin/booleanhexdebug:builtin/continuationhexdebug:builtin/doublehexdebug:builtin/entityhexdebug:builtin/garbagehexdebug:builtin/generichexdebug:builtin/listhexdebug:builtin/matrixhexdebug:builtin/nullhexdebug:builtin/stringhexdebug:builtin/typehexdebug:builtin/vec3