Skip to content

Let players see the recipes of alloys they have forged - #51

Merged
XxFran10xX merged 6 commits into
mainfrom
feat/alloy-recipe-book
Nov 3, 2026
Merged

XxFran10xX merged 6 commits into
mainfrom
feat/alloy-recipe-book

Conversation

@XxFran10xX

Copy link
Copy Markdown
Contributor

Why

Player suggestion (Discord, 5 for / 3 against): a way to see alloy recipes in game, instead of keeping them in a notepad or spreadsheet. fran's condition: only someone who has already forged the alloy can see it.

Change

  • /alloy recipes lists the alloys this account has forged. Each name can be clicked to show its recipe.
  • /alloy recipe <name> shows the base and catalysts. /alloy recipe with an alloy in your main hand shows that alloy's recipe.
  • Only the ingredients are shown. Hits, stats and forge odds stay hidden, in line with the crafting no-spoilers rule.
  • An alloy the player hasn't forged gets "You don't know the recipe for X." whether or not it exists, so names can't be probed. Tab completion offers only the player's own alloys.
  • A recipe whose combo the forge index no longer maps to that alloy (for example, it now gives scrap) is refused with "That recipe no longer makes X."

How "forged it" is stored

  • Every successful forge (not scrap) records the station's combo (base|catalyst,catalyst) in data/known-alloy-recipes/<uuid>.json.
  • A combo doesn't change when an alloy is named or renamed, and it is never reused. Alloy ids do both: generated names are freed again when an alloy is named. So knowledge is stored by combo, and naming, the timeout and the discovery events are left exactly as they were.
  • A player without a file yet starts from their existing forged-alloys history. Main has 19 accounts with 177 entries, and all of them point at existing alloys.
  • Files are written to a temp file and then moved into place. A file that can't be read is left untouched for that session. A failed save is retried on the next forge.
  • Knowledge belongs to the Minecraft account, so it is shared across RPCharacters characters, like professions.

Performance

These are commands only: no listeners, no timers. Each forge does one small file write, and only the first time a combo is forged. A recipe lookup reads one index file and builds the base and catalyst items to get their names (at most 5).

Testing

  • New AlloyRecipeCommandTest (list, recipe, held alloy, stale index, console, tab completion, seeding, unreadable file, failed save) and a forger test (successful forges teach the recipe, scrap doesn't). mvn verify: 176 tests; only the four StationDatabaseCoverageTest/EdgeCoverageTest cases fail, and they fail on Windows on untouched main too.
  • Dev bot test (~/alloyrec-test/test.js, bots AlloyRecA/AlloyRecB), 21/21 PASS:
    • AlloyRecA's list was empty and the recipe refused before forging.
    • Forging limpsteel at an alloy forge recorded iron_ingot|peridot,turquoise.
    • After that, the list showed Limpsteel, and the recipe showed "Base: Iron Ingot / Catalysts: Peridot, Turquoise". Tab completion offered limpsteel, and the held alloy showed the recipe.
    • AlloyRecB got the same refusal for a real alloy and for a made-up name, and was refused while holding limpsteel.
    • No AdvancedCrafting errors in the log.

🤖 Generated with Claude Code

XxFran10xX and others added 4 commits November 3, 2026 16:19
/alloy recipes lists the alloys this account has forged, each name
clickable. /alloy recipe <name>, or /alloy recipe with an alloy in hand,
shows its base and catalysts. Hits, stats and forge odds stay hidden.
An alloy the player hasn't forged gets "You don't know the recipe" whether
or not it exists, and tab completion offers only their own alloys.

A new alloy whose naming prompt timed out was never recorded for its
discoverer, so they could not see its recipe. The timeout now records it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A second discovery, a restart or a timeout before naming could lose the
discoverer's record. Naming now moves every player's record from the
generated id to the chosen one. A timed-out discovery is credited to the
player as they are now (they may have relogged). A combo that no longer
makes the alloy is not shown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Alloy ids change when an alloy is named and generated ids can be reused,
so keying knowledge by id needed rename scans and changed when discovery
events fire. Successful forges now record the station's combo in
data/known-alloy-recipes/<uuid>.json; a player without a file starts from
their existing forge history. The naming, timeout and event code is back
to what main has. A combo the forge index no longer maps to the alloy is
not shown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 45 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d1473638-5f52-4f27-8777-72155e62ac00
Commits

Reviewing files that changed from the base of the PR and between 4a2a6ba and 74acb6c.

Files selected for processing: 4
  • src/main/java/net/tfminecraft/advancedcrafting/lifecycle/KnownAlloyRecipes.java
  • src/main/java/net/tfminecraft/advancedcrafting/managers/AlloyRecipeCommand.java
  • src/main/java/net/tfminecraft/advancedcrafting/objects/data/AlloyRecipe.java
  • src/test/java/net/tfminecraft/advancedcrafting/AlloyRecipeCommandTest.java
Summary

Summary by CodeRabbit

  • New Features
    • Added /alloy recipes to list alloys you have forged, and /alloy recipe to view a learned recipe by name or from the held alloy.
    • Recipes learned through successful forging are saved between sessions. Recipe details show the base ingredient and catalysts.
    • Added command suggestions for the available subcommands and learned recipes.

The plugin now stores forged alloy recipe knowledge per player. Players can list learned recipes and view a recipe by alloy name or held alloy. The alloy command also provides recipe-related tab completions.

Changes: Known Alloy Recipe Discovery

Layer / File(s) Summary
Recipe knowledge storage and loading
src/main/java/net/tfminecraft/advancedcrafting/lifecycle/KnownAlloyRecipes.java, src/main/java/net/tfminecraft/advancedcrafting/lifecycle/PlayerAlloyForgeTracker.java, src/main/java/net/tfminecraft/advancedcrafting/AdvancedCrafting.java, src/test/java/net/tfminecraft/advancedcrafting/AlloyRecipeCommandTest.java
The plugin loads and saves known recipe keys per player. It seeds missing files from forge history and initialises the store during startup. Tests cover loading, seeding, and persistence behaviour.
Learning recipes after forging
src/main/java/net/tfminecraft/advancedcrafting/objects/alloys/AlloyForger.java, src/test/java/net/tfminecraft/advancedcrafting/ForgerCoverageTest.java
The forge process records the station recipe for non-scrap outcomes. Tests check that scrap does not teach a recipe.
Recipe lookup commands and completions
src/main/java/net/tfminecraft/advancedcrafting/managers/AlloyRecipeCommand.java, src/main/java/net/tfminecraft/advancedcrafting/managers/CommandManager.java, src/main/resources/plugin.yml, src/test/java/net/tfminecraft/advancedcrafting/AlloyRecipeCommandTest.java, src/test/java/net/tfminecraft/advancedcrafting/CommandCoverageTest.java
The alloy command supports recipe listing and lookup by name or held alloy. Tab completion offers recipe subcommands and learned alloys. Tests cover command responses, visibility, and completion behaviour.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  actor Player
  participant CommandManager
  participant AlloyRecipeCommand
  participant KnownAlloyRecipes
  Player->>CommandManager: Request learned recipe list
  CommandManager->>AlloyRecipeCommand: Dispatch recipe list
  AlloyRecipeCommand->>KnownAlloyRecipes: Check player recipe knowledge
  KnownAlloyRecipes-->>AlloyRecipeCommand: Return known recipe keys
  AlloyRecipeCommand-->>Player: Show learned recipes
Loading

Suggested reviewers: ryanbarlow97

Merge Risk: Moderate · previous review 4a2a6

The build’s coverage check is failing, and a locale change between restarts can make a learned recipe appear unknown. Resolve the coverage failures and stabilize recipe-key normalization before merging.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1e64058a-9f90-4f18-8487-3d9ab9a59c20
Commits

Reviewing files that changed from the base of the PR and between 3179328 and 4a2a6ba.

Files selected for processing: 10
  • src/main/java/net/tfminecraft/advancedcrafting/AdvancedCrafting.java
  • src/main/java/net/tfminecraft/advancedcrafting/lifecycle/KnownAlloyRecipes.java
  • src/main/java/net/tfminecraft/advancedcrafting/lifecycle/PlayerAlloyForgeTracker.java
  • src/main/java/net/tfminecraft/advancedcrafting/managers/AlloyRecipeCommand.java
  • src/main/java/net/tfminecraft/advancedcrafting/managers/CommandManager.java
  • src/main/java/net/tfminecraft/advancedcrafting/objects/alloys/AlloyForger.java
  • src/main/resources/plugin.yml
  • src/test/java/net/tfminecraft/advancedcrafting/AlloyRecipeCommandTest.java
  • src/test/java/net/tfminecraft/advancedcrafting/CommandCoverageTest.java
  • src/test/java/net/tfminecraft/advancedcrafting/ForgerCoverageTest.java

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@XxFran10xX

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@github-actions github-actions Bot added the size:L 100-499 effective changed lines (tests excluded in mixed PRs). label Nov 3, 2026
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
coderabbitai[bot]
coderabbitai Bot previously requested changes Nov 3, 2026

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Fix comments: Fix CodeRabbit comments on this PR

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@XxFran10xX

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@XxFran10xX

Copy link
Copy Markdown
Contributor Author

Independent review of 74acb6c (CodeRabbit was rate limited): APPROVE, no blocking findings. Notes kept as known limits: a history alloy that failed to load at a player's first seed is not re-seeded (no missing ids on Main); the known-recipe cache is main-thread only (Bukkit tab completion runs there); /alloy recipe with a trailing space says "You don't know the recipe for .".

@XxFran10xX
XxFran10xX dismissed coderabbitai[bot]’s stale review November 3, 2026 20:25

All three findings are resolved: CodeRabbit accepted the Locale.ROOT fix (74acb6c) and withdrew the two coverage findings (covered in ba7b43a). The re-review was rate limited; an independent review approved 74acb6c.

@XxFran10xX
XxFran10xX merged commit 0b2cf85 into main Nov 3, 2026
3 checks passed
@XxFran10xX
XxFran10xX deleted the feat/alloy-recipe-book branch November 3, 2026 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 effective changed lines (tests excluded in mixed PRs).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant