The Twilight Forest

The Twilight Forest

140M Downloads

Cloud Block Performance

pitbox46 opened this issue ยท 1 comments

commented

The Suggestion

The ASM Injection for isRainingAt quite expensive when it doesn't need to be (1.71% of tick time on the ATM9 modpack).
TFConfig.COMMON_CONFIG.cloudBlockPrecipitationDistanceCommon.get() for is called every iteration of the loop rather than only being called once. Also there may be better ways to call getBlockState given we're always going to be in the same chunk, just different y-values.
https://github.com/TeamTwilight/twilightforest/blob/76bce170248b5e35e9c9781635c7049ddd237d40/src/main/java/twilightforest/ASMHooks.java#L327C16-L327C24

I would have written a PR myself for this, but unfortunately I am too busy right now to be bothered with setting up the project and doing the proper testing.

Why Should It Be in the Mod?

Performance enhancement which would reduce tick times without impacting functionality at all

Please Read and Confirm the Following

  • I have confirmed this suggestion is unique and has not been suggested already.
commented

Implemented the solutions you have suggested. If you can think of any other way to optimize, I'd be very happy to hear it