Skip to content

fix: stack aging foods consistently on inventory clicks - #77

Merged
ryanbarlow97 merged 1 commit into
mainfrom
fix/quality-item-stacking
Oct 13, 2026
Merged

ryanbarlow97 merged 1 commit into
mainfrom
fix/quality-item-stacking

Conversation

@ryanbarlow97

Copy link
Copy Markdown
Contributor

Summary

Matching Cooking foods can stop stacking while an inventory is open because their hidden aging data differs. Inventory clicks now merge compatible food stacks using the older food's data, regardless of which stack is on the cursor.

  • Support left-click, single-item right-click, and shift-click transfers in player inventories and ordinary storage containers.
  • Respect stack limits and preserve excess items, different qualities, freshness stages, and other item metadata. Honor cancelled events, character readiness, restricted slots, and custom inventory holders.

Documentation impact

  • Central Cooking documentation: no change; fixes existing stacking behavior without changing configuration or commands.

Contract

  • Affected behavior: manual Cooking food stacking in player inventories, chests, barrels, ender chests, and shulker boxes. Machine inventories and custom inventory holders retain their own handling.
  • Tests: tfmc-mvn -o -B clean verify — 1,148 tests, zero failures/errors/skips; coverage gate passed. Includes 22 new regression cases covering both cursor directions, right-click amounts, shift transfers, full inventories, age preservation, and protected item/slot differences. The initial regression suite reproduced eight failures before the fix.
  • Player wiki (ProvinceSystem /wiki/cooking): no change.

Notes

  • Automated verification uses MockBukkit; no live Paper/client test or deployment has been performed.
  • The reported screenshot did not identify the item type. This fixes the demonstrated Cooking path; it does not establish that other quality-item systems are affected.

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

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

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: 66eb689a-5ca5-4578-9a64-9bcedf34260a
📥 Commits

Reviewing files that changed from the base of the PR and between e3717f8 and d95c662.

📒 Files selected for processing (2)
  • src/main/java/net/tfminecraft/cooking/manager/ConversionManager.java
  • src/test/java/net/tfminecraft/cooking/manager/FoodInventoryClickTest.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
    • Compatible food stacks can now be combined in supported storage inventories. Left-click moves as much as fits, while right-click moves one item.
    • Shift-clicking combines food with matching stacks and uses empty slots for any remainder.
    • When food is combined, its freshness and other item details are preserved, using the more-aged stack’s freshness. Items with different quality, details or freshness remain separate.

The change adds food-aware handling for left-click, right-click and shift-click actions in supported inventories. It checks player context, inventory types, holders and slots before handling clicks. MockBukkit tests cover merging, movement and cases that remain unchanged.

Changes: Food inventory stacking

Layer / File(s) Summary
Click eligibility and food merging
src/main/java/net/tfminecraft/cooking/manager/ConversionManager.java, src/test/java/net/tfminecraft/cooking/manager/FoodInventoryClickTest.java
Click handling checks player context, supported inventories, holders and slots. Compatible food merges while retaining the more-aged stack's data. Tests cover click merges, stack limits, incompatible items, and ignored clicks.
Shift-click food movement
src/main/java/net/tfminecraft/cooking/manager/ConversionManager.java, src/test/java/net/tfminecraft/cooking/manager/FoodInventoryClickTest.java
Shift-clicks fill compatible stacks before empty slots. Unplaced items remain at the source. Tests cover movement between chest and player inventories, including limited capacity.

Priority: ➖ Normal

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

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant InventoryClickEvent
  participant ConversionManager
  participant PlayerActionContext
  participant Inventory
  InventoryClickEvent->>ConversionManager: onClick(event)
  ConversionManager->>PlayerActionContext: capture player context
  ConversionManager->>Inventory: check inventory and slots
  ConversionManager->>Inventory: merge compatible food and update remainder
Loading

Suggested reviewers: xxfran10xx

Merge Risk: ⚪ Minimal · up to d95c6

No actionable issue is established that would prevent merging after normal checks.

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

@ryanbarlow97
ryanbarlow97 merged commit 99c0197 into main Oct 13, 2026
3 checks passed
@ryanbarlow97
ryanbarlow97 deleted the fix/quality-item-stacking branch October 13, 2026 11:15
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