Skip to content

Fix Display wall settings disconnecting Fabric clients - #13

Merged
rubensworks merged 1 commit into
master-1.21-ltsfrom
fix/fabric-wall-menu
Oct 11, 2026
Merged

rubensworks merged 1 commit into
master-1.21-ltsfrom
fix/fabric-wall-menu

Conversation

@rubensworks

Copy link
Copy Markdown
Member

Opening the settings of a Display Chest Wall (right-click with an empty hand) on Fabric disconnected the client with IndexOutOfBoundsException: Index 36 out of bounds for length 36 in ClientboundContainerSetContentPacket.

Cause
On Fabric, Cyclops Core's openMenu writes the menu's open data when the packet is encoded, on the Netty IO thread, not when the menu opens. ContainerDisplay.writeOpenData read wall.getDisplayFaces() at that moment, and off the server thread it found no formed chest, so it sent zero faces. The client then built the menu with only the 36 player slots, while the server menu also had one ghost slot per face. I confirmed this with logging: the server wrote faces=[] from Netty Server IO, while its own menu had 2 faces.

Fix
ContainerDisplay.openDataWriter and ContainerChest.openDataWriter read everything when the menu opens and return a writer of those values. The Display wall and the chest core open their menus through them. The chest GUI wasn't visibly broken, but it read its slot and upgrade counts at encode time too, so it could race with a resize. Interface, Redstone and Magnet walls and the Material Upgrade Tool only write a position or hand, so they were fine.

Testing

  • New game test testDisplayOpenDataReadWhenOpening: it creates the writer while the chest is formed, breaks the chest, then writes. With the old lazy writer it fails (Expected faces on the client to be 1, but was 0); with the fix it passes.
  • ./gradlew build passes. Game tests pass on NeoForge (102), Forge (102) and Fabric (104).
  • Fabric dev client via clientdevbridge: before the fix, opening a Display wall's settings reproduced the reported error and the disconnect. After the fix the settings open with matching menus (38 slots on client and server, faces north and west), with no errors in the log.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RSz5r6eowhjNuANBjZE2v6


Generated by Claude Code

Fabric writes menu open data later, on the network thread, where the
Display wall saw no formed chest and sent no faces. The client then
built a smaller menu than the server. Open data is now read when the
menu opens, also for the chest GUI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RSz5r6eowhjNuANBjZE2v6
@rubensworks
rubensworks merged commit 719b589 into master-1.21-lts Oct 11, 2026
3 checks passed
@rubensworks
rubensworks deleted the fix/fabric-wall-menu branch October 11, 2026 04:34
@github-actions

Copy link
Copy Markdown

Coverage Report for CI Build 38111870486

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Coverage increased (+0.2%) to 76.531%

Details

  • Coverage increased (+0.2%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 42 coverage regressions across 3 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

42 previously-covered lines in 3 files lost coverage.

File Lines Losing Coverage Coverage
org/cyclops/colossalchests2/inventory/ContainerChest.java 25 78.8%
org/cyclops/colossalchests2/inventory/ContainerDisplay.java 11 65.88%
org/cyclops/colossalchests2/gametest/GameTestsCommon.java 6 97.0%

Coverage Stats

Coverage Status
Relevant Lines: 6898
Covered Lines: 5582
Line Coverage: 80.92%
Relevant Branches: 2851
Covered Branches: 1879
Branch Coverage: 65.91%
Branches in Coverage %: Yes
Coverage Strength: 9.89 hits per line

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants