Skip to content

Only compute solid blocks once #3068

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

Merged
merged 2 commits into from
Jan 18, 2025
Merged

Conversation

SirYwell
Copy link
Member

@SirYwell SirYwell commented Jan 8, 2025

Overview

Description

SolidBlockMask previously went through all block states on construction to find all movement-blocking block states. While that doesn't take much time, it adds up as the mask is used in other places, e.g. on every click with a brush. Precalculating the values only once additionally allows us to use the information in other places where we previously called into NMS code through multiple layers of abstraction to check whether a block blocks movement.
For example operations using an angle mask can benefit from that.

### Submitter Checklist
- [x] Make sure you are opening from a topic branch (**/feature/fix/docs/ branch** (right side)) and not your main branch.
- [x] Ensure that the pull request title represents the desired changelog entry.
- [x] New public fields and methods are annotated with `@since TODO`.
- [x] I read and followed the [contribution guidelines](https://github.com/IntellectualSites/.github/blob/main/CONTRIBUTING.md).

@SirYwell SirYwell requested a review from a team as a code owner January 8, 2025 17:49
Copy link
Member

@PierreSchwang PierreSchwang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

untested, but looks good

@dordsor21 dordsor21 merged commit b27f671 into main Jan 18, 2025
9 checks passed
@dordsor21 dordsor21 deleted the perf/SolidBlockMask-precompute branch January 18, 2025 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants