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.
I was messing around with observers and thought this could also be useful for the base project.
This PR implements observer functionality for both redpiler and the base redstone backend, closing #73. It also includes a bunch of observer related tests. I am fairly sure the observer implementation is accurate and exactly matches vanilla.
The changes to block updates may slightly negatively impact performance, especially when not using redpiler. However, it is just a simple loop to check for adjacent blocks when a block is updated, so I imagine it is fine.
When using redpiler, performance should be nearly identical, the only change being that node updates are now also done for repeater locking and output blocks (e.g. lamps turning on or trapdoors changing state).
Also, Redpiler will now only update nodes when their maximum input signal strength has changed, since no node actually uses any signal strength below the max. (This change was needed for observers to work correctly, but I implemented it for every node.)