Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected void compile(PageCompiler compiler, LytBlockContainer parent, MdxJsxEl

int meta = MdxAttrs.getInt(compiler, parent, el, "meta", Integer.MIN_VALUE);
String nbt = MdxAttrs.getString(compiler, parent, el, "nbt", null);
float scale = MdxAttrs.getFloat(compiler, parent, el, "scale", 1f);
float scale = MdxAttrs.getFloat(compiler, parent, el, "scale", 4f);
String perspective = MdxAttrs.getString(compiler, parent, el, "perspective", null);
int width = MdxAttrs.getInt(compiler, parent, el, "width", 128);
int height = MdxAttrs.getInt(compiler, parent, el, "height", 128);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ private String renderBlockImage(MdxJsxElementFields element, String defaultNames
currentPageId,
templates,
false,
readFloat(element, "scale"));
readBlockImageScale(element));
}

GuideSiteExportedScene exportedScene = sceneResolver.nextScene();
Expand All @@ -806,7 +806,7 @@ private String renderBlockImage(MdxJsxElementFields element, String defaultNames
currentPageId,
templates,
false,
readFloat(element, "scale"),
readBlockImageScale(element),
true);
}

Expand All @@ -821,6 +821,11 @@ private String wrapBlockImageFloat(MdxJsxElementFields element, String html) {
return "<span class=\"guide-floating-image-wrap\" style=\"" + escapeAttribute(style) + "\">" + html + "</span>";
}

private Float readBlockImageScale(MdxJsxElementFields element) {
Float scale = readFloat(element, "scale");
return scale == null ? 4f : scale;
}

@Nullable
private String resolveBlockFloatDirection(MdxJsxElementFields element) {
String wrap = readOptional(element, "wrap");
Expand Down
4 changes: 2 additions & 2 deletions wiki/Images-And-Assets-zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,15 +288,15 @@ GuideNH 页面也可以引用非图片类运行时资源,最常见的是结构
- 背景透明,边框透明
- 没有场景按钮,没有 layer 滑条,也没有注解编辑面
- 悬停时依然会显示方块选中线框与 tooltip
- `scale` 控制相机缩放
- `scale` 控制相机缩放,默认值为 `4`
- `perspective` 支持 `isometric-north-east`、`isometric-north-west`、`up`
- `nbt` 用于提供 TileEntity SNBT;`id="mod:block:meta:{...}"` 形式的内联 SNBT 仍然可用,
但独立 `nbt` 属性更清晰,推荐优先使用

示例:

````md
<BlockImage id="minecraft:stone" scale="2" />
<BlockImage id="minecraft:stone" />
<BlockImage id="minecraft:furnace" perspective="isometric-north-west" scale="2.5" />
<BlockImage
id="minecraft:chest"
Expand Down
4 changes: 2 additions & 2 deletions wiki/Images-And-Assets.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,15 +293,15 @@ Key behavior:
- transparent background and border
- no scene buttons, no layer slider, no annotation authoring surface
- hover still shows the selected block outline and tooltip
- `scale` changes camera zoom
- `scale` changes camera zoom and defaults to `4`
- `perspective` accepts `isometric-north-east`, `isometric-north-west`, and `up`
- `nbt` supplies tile-entity SNBT; inline `id="mod:block:meta:{...}"` SNBT still works, but the
standalone `nbt` attribute is easier to read and is preferred

Example:

````md
<BlockImage id="minecraft:stone" scale="2" />
<BlockImage id="minecraft:stone" />
<BlockImage id="minecraft:furnace" perspective="isometric-north-west" scale="2.5" />
<BlockImage
id="minecraft:chest"
Expand Down
4 changes: 2 additions & 2 deletions wiki/Tags-Reference-zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
| `<Column>` | 纵向 flex 布局 | `gap`, `alignItems`, `fullWidth`, `width` |
| `<FootnoteList>` | 运行时 Markdown 脚注使用的限宽脚注容器 | `width` |
| `<ItemGrid>` | 紧凑物品图标网格 | 子元素必须是 `<ItemIcon id="..."/>` 或 `<ItemIcon ore="..."/>` |
| `<BlockImage>` | 非交互式的 3D 单方块预览 | `id` 或 `ore`,`scale`,`float`,`perspective`,`nbt` |
| `<BlockImage>` | 非交互式的 3D 单方块预览 | `id` 或 `ore`,可选 `scale`(默认 `4`),`float`,`perspective`,`nbt` |
| `<FloatingImage>` | 支持浮动或真正行内放置的裁剪图片块 | `src`, `x`, `y`, `width` / `w`, `height` / `h`, `scaleX`, `scaleY`, `displayWidth`, `displayHeight`, `wrap`, `align`, `title` |
| `<SubPages>` | 导航子页面列表 | `id`, `alphabetical` |
| `<Category>` | 分类页面列表 | `name`, `rows` |
Expand Down Expand Up @@ -459,7 +459,7 @@ GuideNH 会在运行时 Markdown 脚注展开后内部使用这个块标签。
| --- | --- |
| `id` | 方块 id;支持常规 `modid:block[:meta][:{snbt}]` 写法 |
| `ore` | 矿辞查询;使用第一个匹配到的方块物品 |
| `scale` | 相机缩放倍率,默认 `1` |
| `scale` | 相机缩放倍率,默认 `4` |
| `float` | 旧版流式浮动支持:`left` 或 `right` |
| `perspective` | `isometric-north-east`(默认)、`isometric-north-west` 或 `up` |
| `nbt` | 可选的 TileEntity SNBT;会合并到 `id` 内联 SNBT 之上 |
Expand Down
4 changes: 2 additions & 2 deletions wiki/Tags-Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Inline markdown also supports action links for sound playback:
| `<Column>` | vertical flex layout | `gap`, `alignItems`, `fullWidth`, `width` |
| `<FootnoteList>` | width-constrained footnote container used by runtime markdown footnotes | `width` |
| `<ItemGrid>` | compact grid of item icons | children must be `<ItemIcon id="..."/>` or `<ItemIcon ore="..."/>` |
| `<BlockImage>` | non-interactive 3D single-block preview | `id` or `ore`, `scale`, `float`, `perspective`, `nbt` |
| `<BlockImage>` | non-interactive 3D single-block preview | `id` or `ore`, optional `scale` (defaults to `4`), `float`, `perspective`, `nbt` |
| `<FloatingImage>` | cropped image block with float or true inline placement | `src`, `x`, `y`, `width` / `w`, `height` / `h`, `scaleX`, `scaleY`, `displayWidth`, `displayHeight`, `wrap`, `align`, `title` |
| `<SubPages>` | navigation child listing | `id`, `alphabetical` |
| `<Category>` | list pages from a category | `name`, `rows` |
Expand Down Expand Up @@ -486,7 +486,7 @@ selection outline and tooltip. `ore` must resolve to a block item stack.
| --- | --- |
| `id` | block id; supports the normal `modid:block[:meta][:{snbt}]` spelling |
| `ore` | ore dictionary lookup; the first matching block item wins |
| `scale` | camera zoom multiplier, default `1` |
| `scale` | camera zoom multiplier, default `4` |
| `float` | legacy flow float support: `left` or `right` |
| `perspective` | `isometric-north-east` (default), `isometric-north-west`, or `up` |
| `nbt` | optional SNBT tile-entity data merged onto any inline SNBT from `id` |
Expand Down
2 changes: 2 additions & 0 deletions wiki/resourcepack/assets/guidenh/guidenh/_en_us/images.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,10 @@ Icon shown, no tooltip:
## BlockImage Scale

`BlockImage` now renders a transparent 3D placed-block preview rather than an item-form icon.
When `scale` is omitted, it defaults to `4`.

<Row>
<BlockImage id="minecraft:stone" />
<BlockImage id="minecraft:stone" scale="1" />
<BlockImage id="minecraft:stone" scale="2" />
<BlockImage id="minecraft:stone" scale="3" />
Expand Down
2 changes: 2 additions & 0 deletions wiki/resourcepack/assets/guidenh/guidenh/_zh_cn/images.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,10 @@ categories:
## BlockImage 缩放

`BlockImage` 现在显示的是透明背景的 3D 放置方块预览,而不是物品形态图标。
省略 `scale` 时,默认值为 `4`。

<Row>
<BlockImage id="minecraft:stone" />
<BlockImage id="minecraft:stone" scale="1" />
<BlockImage id="minecraft:stone" scale="2" />
<BlockImage id="minecraft:stone" scale="3" />
Expand Down