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

Prevent lava from loading chunks #491

Merged
merged 2 commits into from
Feb 28, 2025
Merged

Conversation

RecursivePineapple
Copy link
Contributor

@RecursivePineapple RecursivePineapple commented Feb 27, 2025

In my world lava constantly loads chunks, causing quite a big performance hit. It's not so big that it's causing tps lag, but at the same time it's taking up 10-20% of my tick time, so it's low hanging fruit.

I've redirected several World.getBlock + analogues to check if the chunk is loaded first, and if it's not, bail. This change is fairly low risk, since this logic is only used to set flammable things around lava on fire.

Before:
https://spark.lucko.me/kUlsa23drS

BlockLiquidStatic only calls the update method, which only contains the fire logic for lava.
image

After:
https://spark.lucko.me/xjzUlFbAka

image

@RecursivePineapple RecursivePineapple added the bug Something isn't working label Feb 27, 2025
@Caedis
Copy link
Member

Caedis commented Feb 27, 2025

I think grass blocks also had the same issue except with spreading

nvm, we already fixed it for grass

@RecursivePineapple
Copy link
Contributor Author

Fixed the after spark link

Copy link
Contributor

@Pilzinsel64 Pilzinsel64 left a comment

Choose a reason for hiding this comment

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

Just a few small suggestions from my side:

  1. Maybe consider using blockExists instead of chunkExists as it does the shifting for you with some sanity checks. :)
  2. Would the WrapMethod be an option here instead of Redirect?

@RecursivePineapple
Copy link
Contributor Author

@Pilzinsel64 I didn't think it was worth the extra method call, but I swapped to blockExists anyways. I used Redirect to avoid the mandatory allocations that the Wrap injectors have. I doubt there would ever be conflicting mixins, so it should be fine here.

@Dream-Master
Copy link
Member

@Pilzinsel64

@Dream-Master Dream-Master merged commit 7a5129f into master Feb 28, 2025
1 check passed
@Dream-Master Dream-Master deleted the prevent-lava-chunkloading branch February 28, 2025 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants