From a6899ad2294e0537889b05091528695974fadce3 Mon Sep 17 00:00:00 2001 From: Pyrofab Date: Fri, 7 Jun 2024 02:21:14 +0200 Subject: [PATCH] Document Blabber 1.6.0 texture illustration and margins parameters --- public/wiki/blabber/index.md | 45 ++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/public/wiki/blabber/index.md b/public/wiki/blabber/index.md index 4e50a5b..4b7009f 100644 --- a/public/wiki/blabber/index.md +++ b/public/wiki/blabber/index.md @@ -115,6 +115,9 @@ on the screen just fine in languages like English, they may take up too much spa (this also applies to the classic layout, though to a lesser degree). {:.admonition.admonition-important.admonition-icon} +Starting in version 1.6.0, layouts can take additional parameters to customize their render. +Currently (1.6.0), the only supported parameter is `main_text_margins` on the `blabber:rpg` layout. + The JSON looks like this (goes at the top level, replace `"blabber:classic"` with `"blabber:rpg"` for the alternative look): {% capture summary %}
Simple layout JSON
{% endcapture %} @@ -128,6 +131,25 @@ The JSON looks like this (goes at the top level, replace `"blabber:classic"` wit ``` {% endcapture %} {% include details.liquid summary=summary content=example_json %} +{% capture summary %}
Parameterized layout JSON
{% endcapture %} +{% capture example_json %} +```json +{ + "layout": { + "type": "blabber:rpg", + "params": { + "main_text_margins": { + "left": 52, + "right": -4, + "top": 10, + "bottom": 5 + } + } + } +} +``` +{% endcapture %} +{% include details.liquid summary=summary content=example_json %} #### Illustrations @@ -186,7 +208,7 @@ Renders an item stack with optional NBT, as if within an inventory slot. Propert - `anchor` (type: `IllustrationAnchor`): the point of the screen relative to which the `x` and `y` coordinates are computed. By default, will be the top-left corner of the screen. - `x` (type: `integer`): the `X` coordinate of the top-left corner for the drawn item - `y` (type: `integer`): the `Y` coordinate of the top-left corner for the drawn item -- `scale` (type: `float`, optional): the size of the rendered item will be multiplied by this amount. By default, the item will be drawn at the same size as within an inventory slot. +- `scale` (type: `float`, optional) >1.6.0: the size of the rendered item will be multiplied by this amount. By default, the item will be drawn at the same size as within an inventory slot. - `show_tooltip` (type: `boolean`, optional): if set to `true`, will render the item tooltip when the illustration is hovered in the dialogue screen ###### Entity (`blabber:entity`) @@ -212,7 +234,7 @@ Just like `blabber:entity`, but renders a fake entity of the desired type, with - `data` (type: `object`, optional): NBT data to apply to the rendered entity - `anchor`, `x`, `y`, `width`, `height`, `entity_size`, `y_offset`, `stare_at`: refer to the documentation for `blabber:entity` -###### Fake Player (`blabber:fake_player`) +###### Fake Player (`blabber:fake_player`) >1.6.0 Just like `blabber:entity`, but renders a fake player with the desired profile, with optional NBT. Properties: - `profile` (type: `object`): the full profile of the player. You can get it using [this tool](/tools/rolodex). @@ -227,6 +249,25 @@ Just like `blabber:entity`, but renders a fake player with the desired profile, Parts that are *not* in this list will be hidden. By default, all parts are visible. - `anchor`, `x`, `y`, `width`, `height`, `entity_size`, `y_offset`, `stare_at`: refer to the documentation for `blabber:entity` +###### Texture (`blabber:texture`) >1.6.0 + +Renders a rectangular texture or an area thereof. The texture can come from the base game, a mod, or a resourcepack that clients have installed. +Textures may be animated using a `pack.mcmeta` file. Properties: +- `texture` (type: `string`): the ID of the texture in the format `:`, where `` is the path of the PNG image relative to the `assets` directory (extension included) +- `anchor` (type: `IllustrationAnchor`): the point of the screen relative to which the `x` and `y` coordinates are computed. By default, will be the top-left corner of the screen. +- `x` (type: `integer`): the `X` coordinate of the drawn area's upper left corner +- `y` (type: `integer`): the `Y` coordinate of the drawn area's upper left corner +- `width` (type: `integer`): the width of the drawn area, in logical pixels +- `height` (type: `integer`): the height of the drawn area, in logical pixels + +The following properties are optional and allow you to draw a specific region of a texture file: +- `u` (type: `integer`, optional): the `X` coordinate of the upper left corner in the texture file, in real pixels (defaults to 0) +- `v` (type: `integer`, optional): the `Y` coordinate of the upper left corner in the texture file, in real pixels (defaults to 0) +- `textureWidth` (type: `integer`, optional): the actual width of the texture file, in real pixels (defaults to `width`) +- `textureHeight` (type: `integer`, optional): the actual height of the texture file, in real pixels (defaults to `height`) +- `regionWidth` (type: `integer`, optional): the width of the region to draw from the file, in real pixels (defaults to `width`) +- `regionHeight` (type: `integer`, optional): the height of the region to draw from the file, in real pixels (defaults to `height`) + ###### Composition (`blabber:group`) Groups several illustrations together. This type can be nested as desired. Properties: