-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure the terminal exists when creating a monitor peripheral
Previously we had the invariant that if we had a server monitor, we also had a terminal. When a monitor shrank into a place, we deleted the monitor, and then recreated it when a peripheral was requested. As of ab785a0 this has changed slightly, and we now just delete the terminal (keeping the ServerMonitor around). However, we didn't adjust the peripheral code accordingly, meaning we didn't recreate the /terminal/ when a peripheral was requested. The fix for this is very simple - most of the rest of this commit is some additional code for ensuring monitor invariants hold, so we can write tests with a little more confidence. I'm not 100% sold on this approach. It's tricky having a double layer of nullable state (ServerMonitor, and then the terminal). However, I think this is reasonable - the ServerMonitor is a reference to the multiblock, and the Terminal is part of the multiblock's state. Even after all the refactors, monitor code is still nastier than I'd like :/. Fixes #1608
- Loading branch information
Showing
5 changed files
with
276 additions
and
4 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
139 changes: 139 additions & 0 deletions
139
...ts/common/src/testMod/resources/data/cctest/structures/monitor_test.creates_terminal.snbt
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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