Colossal Chests 2: refuse chest cores carrying items in chests - #227
Open
rubensworks wants to merge 1 commit into
Open
rubensworks wants to merge 1 commit into
rubensworks wants to merge 1 commit into
Conversation
A chest core that holds items keeps them on its item when mined. Storing such a core in another chest nests the contents, and doing that repeatedly grows saved data without limit until it overflows. Chests now refuse items that carry a core's contents, also inside shulker boxes and bundles, through every insert path and for locking a slot to a type. Empty cores and other containers are still accepted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RSz5r6eowhjNuANBjZE2v6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A chest core that holds items keeps them on its item when it is mined. Storing such a core in another chest nests the contents, and repeating that grows saved data without limit until the NBT overflows. This PR makes chests refuse those items.
Summary
colossalchests2:chest_contentsitem component), and any item holding one inside vanilla containers: shulker boxes (minecraft:container) and bundles (minecraft:bundle_contents), at any depth. That closes the indirect route of a core in a shulker box in a chest.ChestStorage.canAccept, which every insert path goes through (GUI clicks and shift-clicks, hoppers and other automation, the Display wall, the item handler'sisItemValid; the Magnet wall in Colossal Chests 2, Phase 7: Magnet wall #226 inserts the same way), and inlockTo, since a locked slot stores its type with all components too.Design notes
Item#canFitInsideContainerItems) applies to every stack of an item, so it would also forbid empty cores, and Fabric has no per-stack variant. Refusing on our side covers the recursion: a core's contents can never hold a filled core, directly or through vanilla containers.Validation
insert,insertAutomated, the item handler, andlockTo; a shulker box holding it and a bundle holding that shulker box are refused; an empty core and a shulker box with stone are accepted; the component id matchestestFilledCoresCanNotBeStoredTestNestedChests(3)Totals: 293 unit tests; game tests Fabric 74, Forge 72, NeoForge 72, all passing.
In-game (clientdevbridge): script in
clientdevbridge-screenshots/nested-cores. On NeoForge, a core carrying 100 stone (from breaking a real chest), a shulker box holding it, and a shulker box holding stone were shift-clicked into another chest. Read back from the world: only the stone shulker box was stored; the other two stayed in the inventory. No screenshots, as the result is in the state.Known issues
🤖 Generated with Claude Code
https://claude.ai/code/session_01RSz5r6eowhjNuANBjZE2v6