-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reschedule block entities when chunks are loaded
Minecraft sometimes keeps chunks in-memory, but not actively loaded. If we schedule a block entity to be ticked and that chunk is is then transitioned to this partially-loaded state, then the block entity is never actually ticked. This is most visible with monitors. When a monitor's contents changes, if the monitor is not already marked as changed, we set it as changed and schedule a tick (see ServerMonitor). However, if the tick is dropped, we don't clear the changed flag, meaning subsequent changes don't requeue the monitor to be ticked, and so the monitor is never updated. We fix this by maintaining a list of block entities whose tick was dropped. If these block entities (or rather their owning chunk) is ever re-loaded, then we reschedule them to be ticked. An alternative approach here would be to add the scheduled tick directly to the LevelChunk. However, getting hold of the LevelChunk for unloaded blocks is quiet nasty, so I think best avoided. Fixes #1146. Fixes #1560 - I believe the second one is a duplicate, and I noticed too late :D.
- Loading branch information
Showing
6 changed files
with
171 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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