Potential fix to machinery hatches #157
Merged
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.
In some scenarios, machinery hatches stop working and require manual intervention to re-enable them (for example, fluid inputs stop providing the configured fluids). From debugging, it appears that all hatches are sleeping on startup, and in certain cases, they are never woken up.
There are multiple layers of complexity here, from MMCE’s TileEntitySynchronized implementation to AE2’s tick rate manager, which I didn’t fully investigate. However, I had a world where I could consistently reproduce the issue with some fluid machinery inputs by simply leaving and rejoining the world. Applying the changes in this PR resolved the issue in that scenario.
I assume the device needs to be alerted at least once to exit sleep mode, after which AE2’s tick rate manager handles it.
While I’m sure there are more refined solutions (and this one might not fix every edge case, since technically alertDevice will fail if the grid is null), this could be a good first step toward making machinery hatches more reliable.
Anyone familiar with either MMCE or AE2’s tick rate manager is welcome to provide feedback.