Skip to content

fix: deliver node output into the hopper above the node - #22

Merged
ryanbarlow97 merged 6 commits into
mainfrom
fix/node-output-hopper
Oct 15, 2026
Merged

ryanbarlow97 merged 6 commits into
mainfrom
fix/node-output-hopper

Conversation

@ryanbarlow97

@ryanbarlow97 ryanbarlow97 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Fixes a player ticket: a guild node reported successful cycles but produced nothing. The node menus showed extracted items while the loose output items spawned inside a chest placed on top of the hopper, landed where the hopper could not reach them, and despawned in the force-loaded chunk.

  • Output is inserted into the inventory of the hopper above the node as one transaction, so blocks above the hopper cannot trap or despawn it.
  • A full hopper restores its previous contents and keeps the finished cycle pending: the rolled result is stored on the node and in its saved JSON, delivered as rolled once there is room (activation settles it before taking new inputs), with one suppressed warning per node until delivery succeeds. Refunding the cycle's inputs on deactivation cancels the held output.
  • Breaking a node returns its held output exactly once, and broken nodes are terminal: stale menus can no longer activate, deactivate, refund, or otherwise mutate removed nodes.
  • The previous loose drop remains as the fallback when no hopper is present above the node.

Review: six Sol review rounds, approved at 311a7b5 with no remaining in-scope findings.

Validation: tfmc-mvn -o -B clean verify passed (233 tests, zero failures/errors/skips), including hopper delivery, full-hopper rollback, held-output, refund-cancellation, activation settlement, persistence, and stale-menu regression tests and the 100% line-coverage check. git diff --check passed.

Documentation: TF-Minecraft/Docs#269.

Output previously fell as loose items onto the hopper, so a block above it trapped the items where they despawned while the menu still reported a successful cycle. Insert the output into the hopper inventory as one transaction; a full hopper restores its contents and holds the cycle for retry. The loose drop remains when no hopper is present.
@github-actions github-actions Bot added the size:M 30-99 effective changed lines (tests excluded in mixed PRs). label Oct 15, 2026
@coderabbitai

coderabbitai Bot commented Oct 15, 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 33 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
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bf96a479-b27e-466d-9405-6ceca211d758
📥 Commits

Reviewing files that changed from the base of the PR and between 8bd8584 and 311a7b5.

📒 Files selected for processing: 11
  • src/main/java/net/tfminecraft/dowsing/managers/NodeManager.java
  • src/main/java/net/tfminecraft/dowsing/objects/Node.java
  • src/main/java/net/tfminecraft/dowsing/utils/Database.java
  • src/main/java/net/tfminecraft/dowsing/utils/ItemDropper.java
  • src/test/java/net/tfminecraft/dowsing/managers/NodeManagerEventsTest.java
  • src/test/java/net/tfminecraft/dowsing/managers/NodeRefundMenuTest.java
  • src/test/java/net/tfminecraft/dowsing/objects/NodeBehaviorTest.java
  • src/test/java/net/tfminecraft/dowsing/objects/NodeDeactivationTest.java
  • src/test/java/net/tfminecraft/dowsing/objects/NodeProductionTest.java
  • src/test/java/net/tfminecraft/dowsing/utils/DatabaseTest.java
  • src/test/java/net/tfminecraft/dowsing/utils/ItemDropperTest.java

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: aeb52c7b-d961-4756-a593-4dd8a5cf85b6
📥 Commits

Reviewing files that changed from the base of the PR and between 27af057 and 8bd8584.

📒 Files selected for processing: 2
  • src/main/java/net/tfminecraft/dowsing/utils/ItemDropper.java
  • src/test/java/net/tfminecraft/dowsing/utils/ItemDropperTest.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.

📝 Summary

Summary by CodeRabbit

  • New Features
    • Rewards are now delivered directly into a hopper above a node. If no hopper is present, rewards continue to drop into the world.
  • Bug Fixes
    • When a hopper cannot fit all rewards, its contents are preserved and the reward cycle remains pending for a retry. Repeated blocked deliveries no longer produce repeated warnings.

ItemDropper now sends rewards to a hopper above the node when one is present. If the hopper cannot hold all rewards, it restores the original inventory and returns false so the cycle can retry. Without a hopper, rewards continue to drop in the world.

Changes: Hopper Reward Delivery

Layer / File(s) Summary
Hopper delivery and retry handling
src/main/java/net/tfminecraft/dowsing/utils/ItemDropper.java, src/test/java/net/tfminecraft/dowsing/utils/ItemDropperTest.java
dropItems sends rewards to a hopper above the node when present. deliverToHopper restores the inventory if any reward does not fit, logs the blocked output once per node, and clears the warning after successful delivery. Tests cover successful delivery, rollback, and retry behaviour.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant ItemDropper
  participant HopperInventory
  participant World
  ItemDropper->>HopperInventory: Add reward stacks when a hopper is above the node
  HopperInventory-->>ItemDropper: Return leftovers if capacity is insufficient
  ItemDropper->>HopperInventory: Restore snapshot when delivery fails
  ItemDropper->>World: Drop rewards when no hopper is above the node
Loading
Merge Risk: ⚪ Minimal · up to 8bd85

The change is mergeable after normal checks. A reward may change while a full hopper blocks delivery; this does not warrant holding the merge.

- [ ] 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

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

coderabbitai[bot]
coderabbitai Bot previously approved these changes Oct 15, 2026
A full hopper previously left the cycle to be rerolled on each retry, so blocked output could complete empty or skewed toward whatever fitted. Store the rolled result on the node and in its saved JSON until delivery succeeds, and play the delivery sound only after the whole output is inserted.
Deactivation returns the current cycle's inputs, so a held output kept from that cycle would be delivered for free after reactivation. Clear it once refunds drain the pending inputs; incomplete refunds keep it for the retry, and no refund means the output stays paid for.
Activation now delivers held output before taking new inputs, so a later deactivation refund cannot cancel output earned by an earlier cycle; a hopper that still cannot hold it blocks activation with an error. Breaking a node drops its held output with the node item, so deletion and guild-loss cleanup return the items instead of discarding them.
Two stale menus could both run the removal path, dropping the node item and its held output twice. Mark the node broken on the first break and consume the held output as it is dropped, so repeated removal from any caller is a no-op.
A node removed by validation could still be deactivated from a stale menu, refunding its inputs after its held output had already dropped. Broken nodes now reject activation, deactivation and refunds, and inventory clicks for nodes no longer in the registry close the stale menu without acting. Menu test fixtures now register their node, matching the production invariant.
@ryanbarlow97
ryanbarlow97 merged commit 5d9e9c4 into main Oct 15, 2026
3 checks passed
@ryanbarlow97
ryanbarlow97 deleted the fix/node-output-hopper branch October 15, 2026 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 effective changed lines (tests excluded in mixed PRs).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant