Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use LinkedHashSet for Breadth First Search. #2697

Open
wants to merge 1 commit into
base: 1.20.1
Choose a base branch
from

Conversation

tomprince
Copy link
Contributor

What

When using a spray can that runs out partway through, we want to paint the nearest blocks, rather than a random selection of discovered blocks.

Implementation Details

I changed all the methods of BreadthFirstBlockSearch to return a LinkedHashSet instead of a HashSet, so that the caller can iterate the results in the order found. I could have left .search unchanged, but I think having a consistent behavior for all the methods makes more sense.

Outcome

When a spray can runs out while spraying, the nearest blocks to the initial block will be painted, rather than a random assortment of blocks within range.

When using a spray can that runs out partway through, we want
to paint the nearest blocks, rather than a random selection of
discovered blocks.
@tomprince tomprince requested a review from a team as a code owner January 6, 2025 03:43
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