Skip to content

fix: accept any input and ruin non-exact crafts - #25

Merged
XxFran10xX merged 1 commit into
mainfrom
fix/exact-match-crafting
Sep 28, 2026
Merged

XxFran10xX merged 1 commit into
mainfrom
fix/exact-match-crafting

Conversation

@XxFran10xX

@XxFran10xX XxFran10xX commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Woodworking 0.1.4 only finishes a project when the materials and hits match the recipe exactly, which is the intended rule. The station, though, fills input by bucket (material type, hit type) and refuses anything past a bucket's total. A wrong mix fills the bucket and blocks all further input:

  • 3 whittles on a recipe that wants 1 whittle + 2 engraves: the wood hit bucket is full, engraves are refused ("You dont need more hits with this tool"), and finishing says "You need to complete all the hits".
  • goldmaple instead of amberpine: the wood bucket is full, the right wood is refused, and finishing says "The materials do not match the recipe".

The bench is then stuck until the player cancels it. The bucket limits and messages also hand players the recipe shape.

Change

  • The bench accepts any woodworking material and any tool hit, in any order and amount. Hits no longer wait for all materials first.
  • Finishing with the branding tool gives the furniture only when the materials, their amounts and the hits all match the recipe exactly (the existing checkExactRecipe / checkExactHits).
  • Any other finish ruins the project: the bench is cleared, nothing is refunded, and the player gets a "The craft failed" title.
  • Cancelling (SHIFT + LEFT CLICK with the branding tool) still refunds everything.
  • Removed the now-unused checkItems / checkHits and the CAPACITY, NONE, LACKING_ITEMS, LACKING_HITS feedback values.
  • Saved benches from 0.1.4 load unchanged. Restored off-recipe materials and hits now get their own counters instead of being dropped from the totals.

Note: a successful craft is always an exact match, so the quality title is always the top tier.

Testing

  • Local mvn clean verify
  • CI build
  • Dev bot test (TFMCDev01, woodworking-DEV-20260928-1516, live Dev configs = Main configs): 19/19 checks on Marauder Rum Bottles (live recipe: goldmaple x1, hit x6, small hit x1).
    • Exact recipe: "You made a" title and the furniture drops.
    • A second goldmaple, off-recipe silk and extra hits are all accepted, with no rejection messages. Finishing then shows "The craft failed", drops no furniture and refunds nothing. The bench stays and takes a new project.
    • Right total but wrong hit mix (7 hits, 0 small hits) fails the same way.
    • A hit before any material is accepted. SHIFT + LEFT CLICK cancel still refunds the deposited silk.
    • No Woodworking errors in latest.log.

🤖 Generated with Claude Code

The bench now accepts any woodworking material and any tool hit, in any
order and amount. Finishing with the branding tool gives the furniture only
when the materials, their amounts and the hits match the recipe exactly.
Any other finish ruins the project and the deposited materials are lost.

Previously a wrong mix filled the type bucket, blocked further input and
left the bench stuck until the project was cancelled.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: e9f9bdda-7afc-4a38-a02c-dbca181efd5a

📥 Commits

Reviewing files that changed from the base of the PR and between 48f3c6f and 4d84f0e.

📒 Files selected for processing (4)
  • README.md
  • src/main/java/net/tfminecraft/woodworking/station/StationFeedback.java
  • src/main/java/net/tfminecraft/woodworking/station/StationManager.java
  • src/main/java/net/tfminecraft/woodworking/station/WoodStation.java
💤 Files with no reviewable changes (1)
  • src/main/java/net/tfminecraft/woodworking/station/StationFeedback.java

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


📝 Walkthrough

Walkthrough

The station accepts materials and tool hits without enforcing recipe limits. A project finishes only when its materials and hits match the recipe exactly. A mismatch removes the station without refunding deposited materials. The README also describes refunds for deliberate cancellation.

Changes

Woodworking station rules

Layer / File(s) Summary
Accept and track station inputs
src/main/java/net/tfminecraft/woodworking/station/WoodStation.java
Restored and newly added materials and tool hits can create counters for types outside the recipe. Input acceptance no longer enforces recipe types or capacities.
Validate and handle project finishes
src/main/java/net/tfminecraft/woodworking/station/StationFeedback.java, src/main/java/net/tfminecraft/woodworking/station/WoodStation.java, src/main/java/net/tfminecraft/woodworking/station/StationManager.java, README.md
Finishing requires exact material and hit matches. Any non-success result triggers station removal without a refund and failure effects. The README describes mismatches and deliberate cancellation refunds.

Priority: ⬇️ Low

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

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  actor Player
  participant StationManager
  participant WoodStation
  Player->>StationManager: Submit material or tool hit
  StationManager->>WoodStation: Record input
  Player->>StationManager: Finish project
  StationManager->>WoodStation: Check exact recipe match
  WoodStation-->>StationManager: Return finish result
  alt Result is not SUCCESS
    StationManager->>StationManager: Remove station and show failure effects
  else Result is SUCCESS
    StationManager->>StationManager: Complete craft
  end
Loading

Suggested reviewers: ryanbarlow97

Merge Risk: ⚪ Minimal · up to 4d84f

No confirmed issue currently prevents merging after normal checks. Progress display for off-recipe tool hits remains unverified.

Security Architecture Review

Security architecture risk: 🟡 Moderate · up to 4d84f

A player allowed to use a shared bench can now ruin another player’s unfinished work without a refund. Successful furniture still requires an exact recipe match, and the observed loss is limited to the affected bench.

Retained concerns

  • Medium · security · inferred: A permitted player can trigger the newly destructive mismatch outcome on a station containing another player’s deposited materials; finishing has no project-owner check.
Security review details

Security Blast Radius

  • inferred — The demonstrated destructive outcome is scoped to the deposited work at an interacted-with station. Its effective player exposure depends on the deployed general-use permission, which permits use when no permission is configured.

Security Findings and Attack Paths

  • inferred — A player with use access and a branding tool can finish another player’s non-exact or unfinished project, causing its deposited materials to be discarded. The same player could already invoke the older refunding cancellation path; the non-refunding finish outcome is new.

Trust Boundaries and Controls

  • observed — The event handler checks station location and general permission, and the finish branch checks for an active project and branding tool. Exact validation protects furniture creation, but none of these controls identifies the project contributor.

Resilience and Maintainability Implications

  • observed — Cancellation returns a copy of deposited items, while failed finishing discards that return value and removes the station, making the failed-finish transition unrecoverable through the normal station flow.

Hardening Proposals

  • proposed — If deposited work is intended to belong to its contributor, define and enforce project-level authority before allowing another player to add inputs, cancel, or trigger a destructive finish.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 90.91% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 2 files. (1 skipped: 1 …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: accepting any input and ruining crafts that do not exactly match the recipe.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

A rabbit taps the workbench side,
While wood and tool marks gather wide.
Exact the recipe, craft takes flight,
A mismatch ends the project’s light.
Then hops the hare through sawdust bright.

Comment @coderabbitai help to get the list of available commands.

@XxFran10xX
XxFran10xX merged commit 8a6573d into main Sep 28, 2026
2 checks passed
@XxFran10xX
XxFran10xX deleted the fix/exact-match-crafting branch September 28, 2026 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant