Fix block updates being ignored before initial build completes #2066
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.
If the following sequence of events takes place:
it appears that the section is never actually built a second time with the new information. This causes problems with mods like AE2, which render disconnected cables initially and then connect them with a block update later. When Sodium is installed, and with a PC of the correct speed, it's possible to reliably reproduce behavior in which the cables remain visually disconnected (despite their hitbox changing) until F3+A is run manually. I was also able to make the reproduction more reliable by artificially adding a 2 second delay to chunk meshing tasks.
After several hours of tinkering and analysis, I believe I've found the culprit: the section manager explicitly avoids scheduling render updates for chunks which are not marked as built. This behavior seems incorrect; we need to process block updates as soon as the section has been added to our tracker and a snapshot of its data has been taken.
I've thus changed the logic to always schedule the block update even for non-null sections. On my system this appears to have fixed the issue, but I would like someone more familiar with the chunk tracker to validate that this does not violate some other invariant.