Skip to content

Commit ac37084

Browse files
committed
Add Foreign Ponder Labels documentation
Introduce docs/Foreign Ponder Labels.md describing the foreign ponder label feature: how labels appear when a mod injects scenes into another mod's items, how to register labels via PonderForeignLabelRegistry (plain strings and localized Components), and microfont usage and fallback behavior. Also update Getting Started to add a short entry and link to the new documentation.
1 parent 6439277 commit ac37084

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

docs/Foreign Ponder Labels.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Foreign Ponder Labels
2+
3+
When a mod injects ponder scenes into another mod's items, a small attribution label can appear next to the scene title — rendered in Azimuth's built-in microfont. Labels only show when the scene's namespace differs from the pondered item's namespace, so a mod's own scenes stay clean.
4+
5+
![Foreign ponder label example](./img/foreign-ponder-label.png)
6+
7+
## Registering a label
8+
9+
Call `PonderForeignLabelRegistry.register` during client init, alongside any other ponder registration:
10+
11+
```java
12+
import com.cake.azimuth.ponder.PonderForeignLabelRegistry;
13+
14+
// Plain string — rendered in microfont (A–Z only)
15+
PonderForeignLabelRegistry.register("bits_n_bobs", "BITS N BOBS");
16+
```
17+
18+
The first argument is the mod's namespace (the one used when registering ponder scenes). The second is the label text, automatically uppercased.
19+
20+
### Localised labels
21+
22+
For languages that need characters outside the microfont charset (CJK, Cyrillic, accented Latin, digits, etc.), pass a `Component` instead:
23+
24+
```java
25+
import net.minecraft.network.chat.Component;
26+
27+
PonderForeignLabelRegistry.register(
28+
"bits_n_bobs",
29+
Component.translatable("bits_n_bobs.ponder.label") // resolved at render time
30+
);
31+
```
32+
33+
When any character in the resolved string falls outside the microfont's glyph set, Azimuth automatically falls back to Minecraft's built-in font scaled to match the microfont size. The switch is all-or-nothing per label — no mixing of fonts within a single string.
34+
35+
> The microfont charset is **A–Z**, **<**, **>**, **/**, and **space**. Anything else triggers the fallback.
36+
37+
## Microfont
38+
39+
The microfont is a 3×4 pixel spritesheet font available for general use beyond ponder labels. Static methods live on `Microfont`:
40+
41+
| Method | Description |
42+
|---|---|
43+
| `render(GuiGraphics, String, x, y, color)` | Sprite-only render — unsupported chars produce blank gaps |
44+
| `renderHighlighted(GuiGraphics, String, x, y, color, bgColor)` | Same as above with a filled background rectangle |
45+
| `renderSmart(GuiGraphics, Font, String, x, y, color)` | Auto-detects charset; falls back to MC font at 0.5× scale |
46+
| `calculateWidth(String)` | Pixel width using sprite metrics |
47+
| `calculateSmartWidth(Font, String)` | Width accounting for possible fallback font |
48+
49+
Custom font sheets can be created with `FontSheet.Builder` for different textures or glyph sets.

docs/Getting Started.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,9 @@ Extra outline types built on top of Catnip's outliner. Particularly handy for po
8080
A gold **(New!)** badge on item tooltips in the ponder progress bar when unwatched tutorial scenes exist for that item.
8181

8282
[New Ponder Tooltip](./New%20Ponder%20Tooltip.md)
83+
84+
### Foreign Ponder Labels
85+
86+
A microfont attribution label next to ponder scene titles when a mod injects scenes into another mod's items. Includes automatic fallback to Minecraft's font for non-Latin characters.
87+
88+
[Foreign Ponder Labels](./Foreign%20Ponder%20Labels.md)

0 commit comments

Comments
 (0)