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
6 changes: 4 additions & 2 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,19 +194,21 @@ public static final DeferredHolder<MDRecipeComponent.RecipeComponentFactory<?>,

### Structure NBT Component (`<structure/>`)

Use the structure extension to render a summary, top-down block preview, and bounded NBT tree for `.nbt` structure files directly inside
Use the structure extension to render a summary, top-down block preview, and bounded NBT tree for `.nbt` / `.snbt` structure files directly inside
documents:

```markdown
<structure id="minecraft:village/plains/houses/plains_small_house_1"/>

<structure id="./test.nbt"/>

<structure id="./test.snbt"/>
```

- `id` / `path`: required, target structure file `ResourceLocation`
- `maxDepth`: optional, maximum expansion depth, default `2`
- `maxEntries`: optional, maximum number of keys/list entries shown per level, default `12`
- Relative paths are supported and resolved against the current document directory, including `.nbt` files placed next to the Markdown
- Relative paths are supported and resolved against the current document directory, including `.nbt` / `.snbt` files placed next to the Markdown
document inside the resource pack; in preview mode the matching file is loaded from `run/ageratum_review/`
- The component first shows structure metadata such as size, palette, block count, and entity count, then renders a top-down block preview
followed by a depth-limited NBT tree
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,18 +365,20 @@ public static final DeferredHolder<MDRecipeComponent.RecipeComponentFactory<?>,

### 结构 NBT 组件(`<structure/>`)

使用结构扩展可以在文档中直接渲染 `.nbt` 结构文件的摘要、俯视方块预览与 NBT 树:
使用结构扩展可以在文档中直接渲染 `.nbt` / `.snbt` 结构文件的摘要、俯视方块预览与 NBT 树:

```markdown
<structure id="minecraft:village/plains/houses/plains_small_house_1"/>

<structure id="./test.nbt"/>

<structure id="./test.snbt"/>
```

- `id` / `path`:必填,目标结构文件的 `ResourceLocation`
- `maxDepth`:可选,最大展开深度,默认 `2`
- `maxEntries`:可选,每层最多显示的键/列表项数量,默认 `12`
- 支持相对路径,按当前文档目录解析;可直接读取资源包中与 Markdown 同目录的 `.nbt` 文件,预览模式下则会从 `run/ageratum_review/` 读取对应文件
- 支持相对路径,按当前文档目录解析;可直接读取资源包中与 Markdown 同目录的 `.nbt` / `.snbt` 文件,预览模式下则会从 `run/ageratum_review/` 读取对应文件
- 组件会优先显示结构尺寸、调色板、方块数、实体数等摘要,其后渲染俯视方块预览,并在下方展示受限深度的 NBT 树
- 将鼠标悬停到预览区域的方块上时,可查看方块 ID、结构坐标、palette 索引及是否带块实体数据

Expand Down
10 changes: 6 additions & 4 deletions docs/en/03-markdown-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,21 +283,23 @@ Block content here — supports Markdown syntax.
### Structure NBT Component

Use the `structure` extension to render a summary, top-down block preview, and bounded NBT tree view for
structure files stored under `data/<namespace>/structure/*.nbt`:
structure files (`.nbt` / `.snbt`):

```markdown
<structure id="minecraft:village/plains/houses/plains_small_house_1"/>

<structure id="./test.nbt"/>

<structure id="./test.snbt"/>

```

- `id` / `path`: required, target structure file `ResourceLocation`
- `maxDepth`: optional, maximum expansion depth, default `2`
- `maxEntries`: optional, maximum number of keys/list entries shown per level, default `12`
- Relative paths are supported, for example `./test.nbt` or `../shared/demo.nbt`, resolved against the current document directory and able
to point to `.nbt` files placed next to the Markdown document inside the resource pack
- In preview mode, relative paths are loaded from the matching location under `run/ageratum_review/`
- Relative paths are supported, for example `./test.nbt`, `./test.snbt` or `../shared/demo.nbt`, resolved against the current document directory and able
to point to `.nbt` / `.snbt` files placed next to the Markdown document inside the resource pack
- In preview mode, relative paths are loaded from the matching location under `run/ageratum_review/` (both `.nbt` and `.snbt`)
- Rendered content: structure size, palette/block/entity counts, a top-down block preview, and a depth-limited NBT tree
- Hovering a block in the preview shows its block ID, structure coordinates, palette index, and whether it carries block-entity NBT
- Fallback behavior: if the structure file is missing or cannot be read, the component shows an inline error message
Expand Down
4 changes: 2 additions & 2 deletions docs/en/10-structure-preview-rendering.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Structure Preview Rendering

This document explains how `MDNBTStructureComponent` renders `.nbt` structures inside the guide UI, including the core pipeline and class responsibilities.
This document explains how `MDNBTStructureComponent` renders `.nbt` / `.snbt` (SNBT) structures inside the guide UI, including the core pipeline and class responsibilities.

---

Expand All @@ -9,7 +9,7 @@ This document explains how `MDNBTStructureComponent` renders `.nbt` structures i
The structure preview pipeline is:

1. Resolve the structure target path (including relative paths)
2. Open NBT data from resource packs or preview files
2. Open NBT/SNBT data from resource packs or preview files
3. Place the template into `SandboxRenderLevel`
4. Render it through `StructurePreviewRenderer` into the markdown UI

Expand Down
9 changes: 5 additions & 4 deletions docs/zh/03-markdown-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,21 +282,22 @@ CommonMark 可转义标点符号(`!`、`"`、`#`、`$`、`%`、`&`、`'`、`(`

### 结构 NBT 组件

使用 `structure` 扩展,可以在文档中渲染 `data/<namespace>/structure/*.nbt`
结构文件的摘要、俯视方块预览与 NBT 树状视图:
使用 `structure` 扩展,可以在文档中渲染结构文件(`.nbt` / `.snbt`)的摘要、俯视方块预览与 NBT 树状视图:

```markdown
<structure id="minecraft:village/plains/houses/plains_small_house_1"/>

<structure id="./test.nbt"/>

<structure id="./test.snbt"/>

```

- `id` / `path`:必填,目标结构文件的 `ResourceLocation`
- `maxDepth`:可选,最大展开深度,默认 `2`
- `maxEntries`:可选,每层最多显示的键/列表项数量,默认 `12`
- 支持相对路径:如 `./test.nbt`、`../shared/demo.nbt`,相对于当前文档所在目录解析;可直接指向资源包中与 Markdown 同目录的 `.nbt` 文件
- 预览模式下,相对路径会从 `run/ageratum_review/` 下的对应位置读取 `.nbt` 文件
- 支持相对路径:如 `./test.nbt`、`./test.snbt`、`../shared/demo.nbt`,相对于当前文档所在目录解析;可直接指向资源包中与 Markdown 同目录的 `.nbt` / `.snbt` 文件
- 预览模式下,相对路径会从 `run/ageratum_review/` 下的对应位置读取 `.nbt` / `.snbt` 文件
- 渲染内容:结构尺寸、调色板/方块/实体统计、俯视方块预览,以及受限深度的 NBT 树
- 将鼠标悬停在预览区的方块上时,可查看方块 ID、结构坐标、palette 索引及是否带块实体数据
- 回退行为:当结构文件不存在或读取失败时,组件会在文档中显示错误信息
Expand Down
4 changes: 2 additions & 2 deletions docs/zh/10-structure-preview-rendering.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 结构预览渲染说明

本文档说明 `MDNBTStructureComponent` 在 GUI 中渲染 `.nbt` 结构时的主要流程与关键类职责,帮助后续维护与扩展。
本文档说明 `MDNBTStructureComponent` 在 GUI 中渲染 `.nbt` / `.snbt` 结构时的主要流程与关键类职责,帮助后续维护与扩展。

---

Expand All @@ -9,7 +9,7 @@
结构预览是一条“资源解析 -> 沙盒世界装配 -> 渲染输出”的链路:

1. 组件解析目标结构路径(支持相对路径)
2. 从资源包或 preview 目录读取 NBT
2. 从资源包或 preview 目录读取 NBT / SNBT
3. 将结构放置到 `SandboxRenderLevel`
4. 使用 `StructurePreviewRenderer` 在文档 UI 内绘制

Expand Down
Loading
Loading