Optimize Sorting Tree inventory discovery#2669
Open
KaroUniform wants to merge 1 commit into
Open
Conversation
jodlodi
approved these changes
Jul 16, 2026
jodlodi
left a comment
There was a problem hiding this comment.
As the idiot that first implemented this iteration of the sorting engine, yeah this looks to be a lot faster and clean. Thank you for taking a look at this
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.
Summary
Motivation
The previous implementation inspected every block position in the configured cube whenever the Sorting Tree ran. At the default range of 16, that is 35,937 position lookups per activation, and the cost grows cubically with the configured range.
It also retained directional capability caches indefinitely. Those entries were keyed by position and direction without a level, and positions produced by the cube iterator can be mutable, making the long-lived map both unsafe across dimensions and prone to unbounded/corrupted growth.
This change follows the same broad approach as vanilla's Copper Golem: inspect block entities in loaded chunks, then apply the exact configured bounds. It does not load new chunks.
Validation
./gradlew cleanTest build— 80 tests passed