Skip to content

Commit 39b55c8

Browse files
committed
fix(skills): two snippets that do not compile on 1.21.1, and stale member facts
mc-datagen's recipe provider used the 1.21.2+ createRecipeProvider shape; Fabric API 0.116.1 has only buildRecipes(RecipeOutput). mc-mixin-craft's access-widener descriptor was missing its opening paren. mc-hud contradicted HUD-STANDARD §8 on the peek keybind (unbound vs Left Alt, key id, title rule) and read a c.hud.enabled that is a flat enableTierHud. mc-config's example nested a TribulationConfig.Hud the migrator flattened. mc-public-api called the §3.1 rethrow/gate/name 'additions — do them in new code'; the standard makes them normative. mc-networking's comment implied execute() was what made the handler thread-safe. mc-loot-injection now names loot v3. mc-testing-mock and mc-mod-testing cited cultivation#100 as undecided (it landed), a distillation class that was renamed, and guards respite and cultivation now carry.
1 parent 5d71fe6 commit 39b55c8

9 files changed

Lines changed: 62 additions & 57 deletions

File tree

‎.ai/skills/mc-config/SKILL.md‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,19 @@ sections and a `configVersion` field. Group fields into sections so the JSON
2222
stays navigable and the ModMenu screen has natural categories.
2323

2424
```java
25-
public class TribulationConfig {
25+
public class MyModConfig {
2626
public int configVersion = ConfigMigrator.CURRENT_VERSION;
2727
public General general = new General();
2828
public TimeScaling timeScaling = new TimeScaling();
29-
public Hud hud = new Hud(); // client-facing section
29+
public Client client = new Client(); // client-facing section (Prosperity's shape)
3030
// ... one field per section, each its own nested static class
3131
}
3232
```
3333

34+
(Tribulation's HUD fields are *flat* — `enableTierHud`, `hudAnchor`, `hudOffsetX/Y` on
35+
the root — because its migrator flattened an earlier nested `Hud` section; don't copy
36+
a `TribulationConfig.Hud` from older docs, it no longer exists.)
37+
3438
Split **server-authoritative** fields (gameplay rules, caps, toggles that change
3539
balance) from **client-only** fields (HUD anchor, render toggles). Mercantile
3640
keeps a flat object with a documented split; Prosperity nests the client fields

‎.ai/skills/mc-datagen/SKILL.md‎

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -58,33 +58,29 @@ public class MyRecipeProvider extends FabricRecipeProvider {
5858
super(output, registries);
5959
}
6060

61+
// 1.21.1 / Fabric API 0.116: override buildRecipes(RecipeOutput) directly and use the
62+
// static builders. The createRecipeProvider(...) + instance shaped()/has() shape is
63+
// the 1.21.2+ API and does not compile here.
6164
@Override
62-
protected RecipeProvider createRecipeProvider(HolderLookup.Provider registries, RecipeOutput output) {
63-
return new RecipeProvider(registries, output) {
64-
@Override
65-
public void buildRecipes() {
66-
shaped(RecipeCategory.DECORATIONS, MyRegistry.MY_BLOCK)
67-
.define('D', Items.DIAMOND)
68-
.define('S', Items.STICK)
69-
.pattern("DDD")
70-
.pattern(" S ")
71-
.pattern(" S ")
72-
.unlockedBy("has_diamond", has(Items.DIAMOND))
73-
.save(output);
74-
}
75-
};
76-
}
77-
78-
@Override
79-
public String getName() {
80-
return "My Mod Recipes";
65+
public void buildRecipes(RecipeOutput output) {
66+
ShapedRecipeBuilder.shaped(RecipeCategory.DECORATIONS, MyRegistry.MY_BLOCK)
67+
.define('D', Items.DIAMOND)
68+
.define('S', Items.STICK)
69+
.pattern("DDD")
70+
.pattern(" S ")
71+
.pattern(" S ")
72+
.unlockedBy("has_diamond", has(Items.DIAMOND))
73+
.save(output);
8174
}
8275
}
8376
```
8477

78+
Reference: `CultivationRecipeProvider.buildRecipes(RecipeOutput)` and
79+
`DistillationRecipeProvider` — both ship this form.
80+
8581
### Shapeless recipes
8682
```java
87-
shapeless(RecipeCategory.MISC, Items.DIAMOND, 9)
83+
ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.DIAMOND, 9)
8884
.requires(MyRegistry.DIAMOND_BLOCK)
8985
.unlockedBy("has_diamond_block", has(MyRegistry.DIAMOND_BLOCK))
9086
.save(output);

‎.ai/skills/mc-hud/SKILL.md‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public static boolean isHudVisible() {
9898
if (mc.player.isSpectator()) return false; // spectator
9999
if (mc.player.isDeadOrDying()) return false; // death screen + the ticks before it
100100
TribulationConfig c = Tribulation.getConfig();
101-
return c != null && c.hud != null && c.hud.enabled;
101+
return c != null && c.enableTierHud; // Tribulation keeps its HUD fields flat
102102
}
103103
```
104104

@@ -212,14 +212,19 @@ the mouse, pauses the game, or blocks movement (it behaves like vanilla's hold-T
212212
player list). Reference: Tribulation's `TierDetailPanelRenderer`, Mercantile's
213213
`ReputationDetailPanelRenderer`. Class convention: `*DetailPanelRenderer`.
214214

215-
- **Keybind.** Register a `KeyMapping` under Controls → `<Mod>`, **unbound by
216-
default**, labelled "Peek `<Domain>` Detail". Draw the panel only while it's held
217-
*and* the badge's visibility predicate passes.
215+
- **Keybind.** Register a `KeyMapping` under Controls → `<Mod>`, labelled "Peek
216+
`<Domain>` Detail", **default Left Alt** (`GLFW_KEY_LEFT_ALT` — unused by vanilla and
217+
ergonomic to hold; never Tab, which holds the player list this panel imitates). New
218+
keybinds use the id `key.<mod>.peek_detail`; a shipped mod keeps its existing id so
219+
players' rebindings survive. The panel header is the label minus "Peek " —
220+
"`<Domain>` Detail", lang key `hud.<mod>.detail.title`, never the mod's own name.
221+
All three rules are HUD-STANDARD §8; draw the panel only while the key is held *and*
222+
the badge's visibility predicate passes.
218223

219224
```java
220225
// client init
221226
KeyMapping key = KeyBindingHelper.registerKeyBinding(new KeyMapping(
222-
"key.<mod>.peek_<domain>_detail", InputConstants.UNKNOWN.getValue(), "key.categories.<mod>"));
227+
"key.<mod>.peek_detail", GLFW.GLFW_KEY_LEFT_ALT, "key.categories.<mod>"));
223228
HudRenderCallback.EVENT.register(new <Mod>DetailPanelRenderer(key));
224229
// in onHudRender:
225230
if (!key.isDown() || !<Mod>HudOverlay.isHudVisible()) return; // reuse the badge predicate
@@ -256,7 +261,7 @@ player list). Reference: Tribulation's `TierDetailPanelRenderer`, Mercantile's
256261
- [ ] `isHudVisible()` / `getHudHeight()` exposed in the `api` package,
257262
reflection-safe from common code.
258263
- [ ] Offset computed from sibling accessors — no hardcoded sibling heights.
259-
- [ ] A hold-to-peek detail panel (if any): unbound keybind under the mod's category,
264+
- [ ] A hold-to-peek detail panel (if any): Left-Alt-default keybind under the mod's category,
260265
non-capturing (not a `Screen`), the badge's four visibility rules reused, no
261266
slot/accessors, paged (not scrolled) overflow, figures from the server's own
262267
source, and no recipe-viewer/tooltip duplication.

‎.ai/skills/mc-loot-injection/SKILL.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public final class TrophyLootHandler {
4141
EntityType.WARDEN.getDefaultLootTable();
4242

4343
public static void register() {
44+
// net.fabricmc.fabric.api.loot.v3.LootTableEvents — the four-arg lambda is loot
45+
// v3; v2's MODIFY is three-arg and has no registries parameter.
4446
LootTableEvents.MODIFY.register((key, tableBuilder, source, registries) -> {
4547
if (!WARDEN_TABLE.equals(key) || !source.isBuiltin()) {
4648
return;

‎.ai/skills/mc-mixin-craft/SKILL.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ accessWidener v2 named
230230
accessible field net/minecraft/world/inventory/EnchantmentMenu enchantSlots Lnet/minecraft/world/Container;
231231
232232
# Make a private method accessible
233-
accessible method net/minecraft/client/gui/screens/EnchantmentScreen renderBook Lnet/minecraft/client/gui/GuiGraphics;IIF)V
233+
accessible method net/minecraft/client/gui/screens/EnchantmentScreen renderBook (Lnet/minecraft/client/gui/GuiGraphics;IIF)V
234234
235235
# Make a final field mutable
236236
mutable field net/minecraft/world/level/block/EnchantingTableBlock BOOKSHELF_OFFSETS Ljava/util/List;

‎.ai/skills/mc-mod-testing/SKILL.md‎

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -387,18 +387,16 @@ literal and registers a class that holds no tests. `implements FabricGameTest` h
387387
these holes: it is the same predicate the loader itself uses.
388388

389389
Reference implementation: cultivation's `GametestRegistrationTest.java:52-53` for the detection
390-
regex and `:128-148` for the two-way naming check. Distillation's `ManifestEntrypointTest.java`
391-
is worth reading for the assertion *shapes* — `:56-78` and `:103-123` cover all four, and it is
392-
the only carrier that collapses registration parity into a single `assertEquals(discovered,
393-
declared)`. Read it for those and nothing else: its class name is one of the ones ruled out
394-
above, and its detection basis is the annotation regex this section rules out, so it is not a
395-
model for either.
396-
397-
Four of the six existing guards already assert dependency exclusivity as set equality:
398-
distillation `:103-113`, meridian `:175`, mercantile `:92`, instinct `:96`. Tribulation's
399-
`GametestEntrypointTest.java:136` is the containment form the bullet above warns about,
400-
cultivation asserts nothing about `depends` at all, and prosperity and respite carry no guard of
401-
any kind. Those four are the gap; the other four already hold this assertion.
390+
regex and `:128-148` for the two-way naming check. Distillation's `GametestRegistrationTest.java`
391+
(renamed from `ManifestEntrypointTest` and moved onto the canonical regex) is worth reading
392+
for the assertion *shapes* — it collapses registration parity into a single
393+
`assertEquals(discovered, declared)`.
394+
395+
Most members already assert dependency exclusivity as set equality: distillation, meridian
396+
`:175`, mercantile `:92`, instinct `:96`, respite `:170`, and cultivation `:165-176`.
397+
Tribulation's `GametestEntrypointTest.java:136` is the containment form the bullet above
398+
warns about, and prosperity's guard is enforced hub-side by `check-gametest-manifest.py`
399+
rather than by a repo-local test. Those two are the gap.
402400

403401
Concord's own `make gametest-check` is **not** a substitute. The hub checker
404402
(`scripts/check-gametest-manifest.py`) fails on a shipped manifest that declares
@@ -660,8 +658,8 @@ against this list — a mod that fails one of these is behind the rule, not nece
660658
- **Mod-prefixed camelCase gametest batches** — `@GameTest(batch = "...")` values start with
661659
the mod id and continue in camelCase: `distillationAntidotesToggle`, `cultivationWeather`,
662660
`instinctBehaviorsOff`. The prefix earns its keep today in report attribution and batch
663-
filtering — an unprefixed `advancementBeauty` (respite's, currently) does not say which mod it
664-
belongs to in a failure report. It also forecloses a collision: batch names share one namespace
661+
filtering — an unprefixed `advancementBeauty` (respite's, before it was renamed) did not say
662+
which mod it belonged to in a failure report. It also forecloses a collision: batch names share one namespace
665663
across every mod in a gametest run, so two members tested together would merge same-named
666664
batches. Give a batch a name of its own per test where a test sweeps the level (see
667665
`retireLeaked` in `mc-testing-mock`) — same-batch tests run concurrently.

‎.ai/skills/mc-networking/SKILL.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,11 @@ ServerPlayNetworking.registerGlobalReceiver(
186186
MyRequestPayload.TYPE,
187187
(payload, context) -> {
188188
ServerPlayer player = context.player();
189-
// Already on the server thread if using context.player().server.execute(...)
189+
// Fabric's PlayPayloadHandler already runs on the server thread (0.116.1
190+
// ServerPlayNetworking), so world state is safe to touch directly; the
191+
// execute() hop below is only worth keeping to defer work to the next tick.
190192
context.player().server.execute(() -> {
191-
// Safe to mutate world state here
193+
// Safe to mutate world state here (and above, outside the hop)
192194
});
193195
});
194196
```

‎.ai/skills/mc-public-api/SKILL.md‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,11 @@ all it can still do is re-introduce the abandon-the-rest semantics:
194194
DistillationDiscoveryCallback.EVENT.invoker().onDiscover(player, recipeId); // no wrap
195195
```
196196

197-
Distillation and cultivation ship this shape today. Naming the offending
198-
listener class (as meridian's invoker does), the fatal-error rethrow, and the
199-
once-only gate are the additions — do them in new code:
197+
Distillation and cultivation ship the invoker-side `Throwable` catch today. Naming the
198+
offending listener class, the `VirtualMachineError` rethrow, and the once-only gate
199+
are **normative** (API-STANDARD §3.1 rules 1–3, checked by its §10 checklist), not
200+
optional extras: new code carries all three, and a shipped invoker without them is a
201+
conformance item for its repo. Respite and instinct ship the full shape:
200202

201203
```java
202204
/**

‎.ai/skills/mc-testing-mock/SKILL.md‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,8 @@ own flag and skips the refresh that makes it correct. Vanilla's own `stopSleepin
291291
`PlayerList.players`, so `MinecraftServer.stopServer` → `PlayerList.saveAll()` saves every leaked
292292
mock at shutdown anyway — and since each mock carries a `UUID.randomUUID()`, nothing dedups on
293293
either side. It is one save per mock either way; `remove()` moves the write into the run rather
294-
than adding one. (rfizzle/cultivation#100 proposes this change suite-wide; the decision is not
295-
yet recorded there, and its measurements cover only the discard-only side.)
294+
than adding one. (rfizzle/cultivation#100 landed this: `MockPlayers.retire` does the
295+
`PlayerList.remove` and cultivation's guard now requires it.)
296296

297297
For suites whose assertions depend on the player count, sweep with `retireLeaked(helper)` rather
298298
than trusting that every earlier test cleaned up — a test that timed out mid-poll did not.
@@ -306,13 +306,9 @@ iterating, since `retire` mutates it, and note the sweep is single-dimension: a
306306
another level survives it.
307307

308308
A tier-1 source scan can hold this rule for a whole suite — cultivation's
309-
`MockPlayerDiscardTest` shows the shape. Read it for the scanning technique only: it still
310-
matches the literal token `".discard()"` and requires it inside a `finally`, so a suite that
311-
adopts `MockPlayers.retire(player)` *fails* it. Adopting this rule means moving the matched
312-
token to `MockPlayers.retire(<name>)` — matched on the argument rather than the receiver — and
313-
replacing the javadoc paragraph that records the superseded "the player-list entry is
314-
deliberately left in place" rationale. Both are in rfizzle/cultivation#100's acceptance
315-
criteria.
309+
`MockPlayerDiscardTest` (the name predates the `retire` rename) is the model: it matches
310+
`MockPlayers.retire(<name>)` on the argument rather than the receiver, requires it inside
311+
a `finally`, and its javadoc records why a bare `discard()` is the leak, not the fix.
316312

317313
### One `finally` per method
318314

0 commit comments

Comments
 (0)