Skip to content

Commit 773d7de

Browse files
committed
Preshare tweaks
1 parent 06bfb07 commit 773d7de

10 files changed

Lines changed: 60 additions & 74 deletions

File tree

.vitepress/config.mjs

Lines changed: 39 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -63,63 +63,53 @@ try {
6363
console.error('generateHiddenProxies error:', e);
6464
}
6565

66-
// Build the sidebar auto-dynamically by top-level folders in `docs`
66+
// Build the sidebar auto-dynamically by walking the `docs` tree recursively
6767
function buildSidebar() {
68-
const entries = readdirSync(docsDir, { withFileTypes: true });
69-
const sidebar = [];
70-
71-
// Include top-level pages (root .md files other than index.md)
72-
const rootFiles = entries
73-
.filter(e => e.isFile() && e.name.endsWith('.md'))
74-
.map(e => join(docsDir, e.name));
75-
76-
const rootItems = rootFiles
77-
.map(full => {
78-
// Exclude .hidden.md and generated proxies
79-
if (full.endsWith('.hidden.md')) return null;
68+
// recursive helper: return array of sidebar items for a directory
69+
function walk(dir, relPath = '') {
70+
const entries = readdirSync(dir, { withFileTypes: true });
71+
const items = [];
72+
73+
// first process files
74+
for (const e of entries) {
75+
if (!e.isFile() || !e.name.endsWith('.md')) continue;
76+
const full = join(dir, e.name);
77+
// skip hidden and proxies
78+
if (full.endsWith('.hidden.md')) continue;
8079
try {
8180
const content = readFileSync(full, 'utf8');
82-
if (content.includes(PROXY_MARKER)) return null;
83-
} catch (e) {}
81+
if (content.includes(PROXY_MARKER)) continue;
82+
} catch (err) {}
8483
const name = basenameWithoutExt(full);
85-
// Skip index.md (home) unless it's desired
86-
if (name === 'index') return null;
87-
return { text: name, link: `/${name}` };
88-
})
89-
.filter(Boolean);
90-
91-
if (rootItems.length) {
92-
sidebar.push({ text: 'root', items: rootItems });
93-
}
84+
// skip root index (home) at top level
85+
if (relPath === '' && name === 'index') continue;
86+
87+
// compute link
88+
let link;
89+
if (name === 'index') {
90+
// directory index becomes the path to folder
91+
link = `/${relPath}/`.replace(/\\/g, '/');
92+
} else {
93+
link = `/${relPath}/${name}`.replace(/\\/g, '/');
94+
}
95+
items.push({ text: name, link });
96+
}
9497

95-
// For each top-level folder, collect its markdown files (non-hidden, non-proxy)
96-
for (const e of entries) {
97-
if (!e.isDirectory()) continue;
98-
const folderPath = join(docsDir, e.name);
99-
const files = readdirSync(folderPath, { withFileTypes: true })
100-
.filter(f => f.isFile() && f.name.endsWith('.md'))
101-
.map(f => join(folderPath, f.name))
102-
.filter(full => {
103-
if (full.endsWith('.hidden.md')) return false;
104-
try {
105-
const content = readFileSync(full, 'utf8');
106-
if (content.includes(PROXY_MARKER)) return false;
107-
} catch (err) {}
108-
return true;
109-
});
110-
111-
if (!files.length) continue;
112-
const items = files.map(full => {
113-
const name = basenameWithoutExt(full);
114-
// link should be /folder/name (strip any index specialness)
115-
const linkName = name === 'index' ? `/${e.name}/` : `/${e.name}/${name}`;
116-
return { text: name, link: linkName };
117-
});
98+
// then process subdirectories
99+
for (const e of entries) {
100+
if (!e.isDirectory()) continue;
101+
const subdir = e.name;
102+
const childItems = walk(join(dir, subdir), relPath ? `${relPath}/${subdir}` : subdir);
103+
if (childItems.length) {
104+
items.push({ text: subdir, items: childItems });
105+
}
106+
}
118107

119-
sidebar.push({ text: e.name, items });
108+
return items;
120109
}
121110

122-
// Prepend a home link
111+
const sidebar = walk(docsDir);
112+
// ensure home link is first
123113
sidebar.unshift({ text: 'home', link: '/' });
124114
return sidebar;
125115
}

docs/Advancements/Advancements.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ public class MyAdvancements {
2525
.icon(MyItems.MY_ITEM)
2626
.title("My Mod")
2727
.description("Get started with My Mod.")
28-
.after(() -> AllAdvancements.ROOT) // display inside the Create tab omit to create a new advancement tab
29-
.awardedForFree() // immediately award when the player first joins
28+
.after(() -> AllAdvancements.ROOT) // display inside the Create tab as a descendant of create's root, omit this to create a new tab
29+
.awardedForFree() // immediately award when the player first joins, important for advancement tabs
3030
.special(AzimuthAdvancement.TaskType.SILENT)
3131
);
3232

@@ -128,7 +128,6 @@ If you want the advancement to be awarded by a game event (rather than manually)
128128

129129
If none of these are called, a built-in `SimpleCreateTrigger` is created automatically. You can then award the advancement manually (see below).
130130

131-
132131
## Awarding advancements manually
133132

134133
If the advancement uses the built-in trigger (no `.whenX` call), award it directly:
@@ -147,7 +146,6 @@ if (!MyAdvancements.FIRST_CRAFT.isAlreadyAwardedTo(player)) {
147146

148147
`awardTo` will throw `UnsupportedOperationException` if the advancement uses an external trigger.
149148

150-
151149
## `AzimuthAdvancementBehaviour`
152150

153151
If you want a block entity to track a player and award advancements when they interact with it, add `AzimuthAdvancementBehaviour` to its behaviour list:
@@ -167,7 +165,7 @@ Using the static `create` method (rather than constructing directly) means that
167165

168166
### Tracking the player
169167

170-
Call `setPlacedBy` from your block's `setPlacedBy` override to register the player who placed it:
168+
Call `setPlacedBy` from your block's `setPlacedBy` override, that way your block will register the player who placed it:
171169

172170
```java
173171
@Override

docs/Getting Started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Azimuth doesn't require any explicit initialisation on your part just depend on
3131

3232
An expanded version of Create's `BlockEntityBehaviour` that can do significantly more, in effort to replicate features that would typically take new block entity types. All of which is composable on a single `SmartBlockEntity`. You can also *inject* behaviours onto block entities you don't own, without touching their source, making simple soft-compatability easy.
3333

34-
[Super Block Entity Behaviours](./Super Behaviours/Super Behaviours.md)
34+
[Super Block Entity Behaviours](./Super%20Behaviours/Super%20Behaviours.md)
3535

3636
### Advancements
3737

docs/Outlines/Outlines.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ outline
1616

1717
Call `tickGrowingTicksElapsed()` each tick to advance the animation. Once elapsed reaches `growingTicks`, the outline stays at full size.
1818

19-
2019
## `ExpandingLineOutlineInstruction`
2120

2221
A ready-to-use Ponder `TickingInstruction` that wraps `ExpandingLineOutline`. Just add it to your scene and it handles everything.

docs/Super Behaviours/Extension Reference.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ For more about `SuperBlockEntityBehaviour`s, see [Super Block Entity Behaviours]
66

77
| Extension | Description |
88
| --- | --- |
9-
| [`KineticBehaviourExtension`](./Kinetic Extension.md) | Adds propagation positions and rotation transfer overrides for kinetic networks. |
10-
| [`RenderedBehaviourExtension`](./Rendered Extension.md) | Adds behaviour-level BER rendering, optional Flywheel visuals, and optional render bounds expansion. |
11-
| [`ItemRequirementBehaviourExtension`](./Item Requirement Extension.md) | Adds per-behaviour item requirements to schematic requirement flows. |
9+
| [`KineticBehaviourExtension`](./Extensions/Kinetic%20Extension.md) | Adds propagation positions and rotation transfer overrides for kinetic networks. |
10+
| [`RenderedBehaviourExtension`](./Extensions/Rendered%20Extension.md) | Adds behaviour-level BER rendering, optional Flywheel visuals, and optional render bounds expansion. |
11+
| [`ItemRequirementBehaviourExtension`](./Extensions/Item%20Requirement%20Extension.md) | Adds per-behaviour item requirements to schematic requirement flows. |

docs/Super Behaviours/Item Requirement Extension.md renamed to docs/Super Behaviours/Extensions/Item Requirement Extension.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
`ItemRequirementBehaviourExtension` lets a behaviour contribute item requirements to Create's schematic placement flow. Implement this if your behaviour places or represents items that should be listed when a player is deploying a schematic containing this block.
44

5-
For an overview of all extensions, see [Super Block Entity Behaviours](./Super Behaviours.md#extensions).
5+
For an overview of all extensions, see [Super Block Entity Behaviours](../Super%20Behaviours.md#extensions).
66

77
## Implementing
88

docs/Super Behaviours/Kinetic Extension.md renamed to docs/Super Behaviours/Extensions/Kinetic Extension.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
`KineticBehaviourExtension` lets a behaviour participate in kinetic propagation adding extra neighbour positions and overriding the speed that gets propagated. It assumes the block entity this behaviour is attached to is a `KineticBlockEntity`.
44

5-
For an overview of all extensions, see [Super Block Entity Behaviours](./Super Behaviours.md#extensions).
5+
For an overview of all extensions, see [Super Block Entity Behaviours](../Super%20Behaviours.md#extensions).
66

77
## Implementing
88

docs/Super Behaviours/Rendered Extension.md renamed to docs/Super Behaviours/Extensions/Rendered Extension.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
`RenderedBehaviourExtension` lets a behaviour contribute rendering output alongside the block entity it's attached to. There are two rendering paths available: a standard Block Entity Renderer (BER) that works unconditionally, and an optional Flywheel visual for hardware-accelerated rendering. You can use either path or both together.
44

5-
For an overview of all extensions, see [Super Block Entity Behaviours](./Super Behaviours.md#extensions).
5+
For an overview of all extensions, see [Super Block Entity Behaviours](../Super%20Behaviours.md#extensions).
66

77
## Implementing
88

docs/Super Behaviours/Super Behaviours.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,6 @@ Behaviours can implement extension interfaces to opt into additional systems kin
151151

152152
| Extension | Description |
153153
| --- | --- |
154-
| [`KineticBehaviourExtension`](./Kinetic Extension.md) | Adds propagation positions and rotation transfer overrides for kinetic networks. |
155-
| [`RenderedBehaviourExtension`](./Rendered Extension.md) | Adds behaviour-level BER rendering, optional Flywheel visuals, and optional render bounds expansion. |
156-
| [`ItemRequirementBehaviourExtension`](./Item Requirement Extension.md) | Adds per-behaviour item requirements to schematic requirement flows. |
154+
| [`KineticBehaviourExtension`](./Extensions/Kinetic%20Extension.md) | Adds propagation positions and rotation transfer overrides for kinetic networks. |
155+
| [`RenderedBehaviourExtension`](./Extensions/Rendered%20Extension.md) | Adds behaviour-level BER rendering, optional Flywheel visuals, and optional render bounds expansion. |
156+
| [`ItemRequirementBehaviourExtension`](./Extensions/Item%20Requirement%20Extension.md) | Adds per-behaviour item requirements to schematic requirement flows. |

style_guide.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ docs/
1818
Super Behaviours/
1919
Super Behaviours.md
2020
Extension Reference.md
21-
Kinetic Extension.md
22-
Rendered Extension.md
23-
Item Requirement Extension.md
21+
Extensions/
22+
Kinetic Extension.md
23+
Rendered Extension.md
24+
Item Requirement Extension.md
2425
Advancements/
2526
Advancements.md
2627
Outlines/
@@ -63,7 +64,7 @@ PROVIDER.create("my_advancement", b -> b
6364
.icon(MyItems.MY_ITEM)
6465
.title("My Title")
6566
.description("My description.")
66-
.after(() -> AllAdvancements.ROOT) // display inside the Create tab omit to create a new tab
67+
.after(() -> AllAdvancements.ROOT) // display inside the Create tab, omit this to create a new tab
6768
.awardedForFree()
6869
);
6970
```
@@ -89,20 +90,18 @@ For things that are easy to mess up or have non-obvious caveats, use a blockquot
8990

9091
Keep them short. One sentence or two.
9192

92-
9393
## Internal links
9494

9595
Link targets use relative paths and include the `.md` extension:
9696

9797
```markdown
98-
[Super Block Entity Behaviours](./Super Behaviours/Super Behaviours.md)
99-
[Kinetic Extension](./Kinetic Extension.md)
100-
[back to overview](./Super Behaviours.md#extensions)
98+
[Super Block Entity Behaviours](./Super%20Behaviours/Super%20Behaviours.md)
99+
[Kinetic Extension](./docs/Super%20Behaviours/Extensions/Kinetic%20Extension.md)
100+
[back to overview](./Super%20Behaviours.md#extensions)
101101
```
102102

103103
For anchor fragments, use lowercase with hyphens (VitePress converts `## Extensions` `#extensions`).
104104

105-
106105
## What to avoid
107106

108107
- **Horizontal rules (`---`)** don't use them. Section headings already provide visual separation; `---` just adds noise.

0 commit comments

Comments
 (0)