1.19.X/Improve flying scrolls performance #460
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
👋 Heya. Just a pull request improving the performance of the flying scrolls. Because block scanning is expensive, the function checking if there's a beacon nearby was drastically slowing down our server. Especially when multiple people were using their scrolls at the same time.
I've offloaded these checks to happen once per second, depending on the player's tick count. Fabulous scroll was also checking if it was in range of a beacon twice in the same function, so cleaned that up too.
To account for fabulous scroll only checking in range once per 20 ticks instead of per single tick, the probability of xp consumption was increased by 20.