
Performance issue and potential deadlock in lighting
Closed this issue ยท 0 comments
level.getBlockState(pos)
should be replaced by (BlockState) (Object) this
.
There's several issues with level.getBlockState(pos)
in this context:
- Lighting can still be running even if the chunk is (being) unloaded. This will cause unnecessary chunk reloading, and make mspt spikes.
- That method fetches full chunk. When a user cleans their cache with the optimize world button (or alternatively through mcaselector by setting
LightPopulated
to zero, which is more reliable), relighting will be triggered before the chunk becomes a full chunk. In this case, it will deadlock whenever a player reaches that chunk, or outright unable to load the world when it is in the spawn chunks.