Skip to content

Fix BlockNetworkManager.java failing to invalidate chunks properly#507

Merged
TeamDman merged 1 commit into1.19.2from
1.19.2-fix-505-chunk-purge
Feb 25, 2026
Merged

Fix BlockNetworkManager.java failing to invalidate chunks properly#507
TeamDman merged 1 commit into1.19.2from
1.19.2-fix-505-chunk-purge

Conversation

@TeamDman
Copy link
Owner

Fixes #505

Copilot AI review requested due to automatic review settings February 25, 2026 20:38
@TeamDman TeamDman added the bug Something isn't working label Feb 25, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes issue #505 where cables stop working after chunks are unloaded and reloaded. The root cause was that when chunks were purged, the networksByLevelBlockPos lookup table wasn't being cleaned up, leading to stale entries that prevented proper network rebuilding when chunks were reloaded.

Changes:

  • Fixed BlockNetworkManager.purgeChunk() to properly clean up the networksByLevelBlockPos lookup table when chunks are unloaded
  • Renamed clearChunk to purgeChunk to better reflect its contract and added documentation
  • Added comprehensive test case that reproduces the bug and validates the fix

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
SFMBlockNetworkChunkUnloadReproTests.java New test that reproduces issue #505 by simulating chunk unload/reload and verifying network rebuilds correctly
WaterNetworkManager.java Updated to call renamed purgeChunk method
CableNetworkManager.java Updated to call renamed purgeChunk method
BlockNetworkManager.java Fixed purgeChunk to properly clean up networksByLevelBlockPos entries and added defensive checks

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@TeamDman TeamDman merged commit aafcff8 into 1.19.2 Feb 25, 2026
4 checks passed
@TeamDman TeamDman deleted the 1.19.2-fix-505-chunk-purge branch February 25, 2026 20:59
@TeamDman TeamDman added this to the v4.30.0 milestone Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cables stop working after leaving and coming back

2 participants