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

Count fluids by their type to avoid unnecessary reads in Entity#updateFluidHeightAndDoFluidPushing #40

Open
wants to merge 1 commit into
base: mc/1.21.1
Choose a base branch
from

Conversation

wuangg
Copy link

@wuangg wuangg commented Oct 1, 2024

Avoid searching for chunk sections that don't only have non empty blocks, but also non empty fluids

@wuangg wuangg changed the title Count fluids by their type to avoid uncessary reads in Entity#updateFluidHeightAndDoFluidPushing Count fluids by their type to avoid unnecessary reads in Entity#updateFluidHeightAndDoFluidPushing Oct 2, 2024
Copy link
Contributor

@embeddedt embeddedt left a comment

Choose a reason for hiding this comment

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

The logic here does not look correct for modded. Water and lava are not the only possible fluids.

I would suggest making the count generic and just counting non-empty fluidstates in the chunk section instead.

@wuangg
Copy link
Author

wuangg commented Oct 5, 2024

Since Fabric/Vanilla version of the method has the TagKey as a parameter, we would like to only check for the count of non-empty fluid states that have the same fluid TagKey to avoid unnecessary chunk section searches that do not have any fluid has the same TagKey as the parameter.

As for modded fluid/NeoForge version of the method, I will implement a counter for generic non-empty fluid states.

@wuangg wuangg force-pushed the check-empty-fluid branch 3 times, most recently from 5fea434 to 0f27657 Compare October 5, 2024 11:54
…eFluidHeightAndDoFluidPushing

We can take fluid counts in a chunk section into account to
avoid unnecessary searches as we were only checking for non
empty blocks.
@wuangg
Copy link
Author

wuangg commented Oct 5, 2024

Counter for generic non-empty fluid states has been implemented.

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.

2 participants