Fix server lag from WillHandler creating empty WillChunks for every loaded chunk (#2151)#2178
Merged
wrincewind merged 1 commit intoWayofTime:1.20.1from Apr 22, 2026
Merged
Conversation
Removes the automatic generation of Demon Will when a chunk is loaded without existing NBT data, preventing unintended will accumulation and hasmap pollution.
stellanera98
approved these changes
Apr 22, 2026
Collaborator
|
I only just caught that #2151 has been closed by this - i've re-opened it and marked it as 'fixed in dev'. i'm about to be away until sunday or so, i figure we'll push a new version early next week (barring any other major bug reports that we want to tackle, or similar). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #2151.
From the discord discussion;
WillHandler.chunkLoad at src/main/java/wayoftime/bloodmagic/util/handler/event/WillHandler.java:250ish fires on every chunk load. When a chunk has no BloodMagic NBT, it falls into:
so
generateWill (WorldDemonWillHandler.java:210)creates an empty WillChunk (base=1, empty DemonWillHolder) and puts it into the per-world ConcurrentHashMap. Every chunk unload removes it. In a server with lots of chunk churn (many players, chunk loaders, dimension hops or fast fliers), this is a constant stream of put/remove on the map for chunks that have no actual demon will activity. Which is consistent with the profiler results, should be easy enough to fix by just dropping the else { generateWill(...) } in chunkLoad. Chunks with real will NBT still flow through the if branch and everything else is lazy-loaded on demand.