Skip to content

Fix missing presets in full palettes with duplicate entries - #90

Closed
ceifa wants to merge 1 commit into
DrexHD:mainfrom
ceifa:fix/duplicate-palette-presets
Closed

ceifa wants to merge 1 commit into
DrexHD:mainfrom
ceifa:fix/duplicate-palette-presets

Conversation

@ceifa

@ceifa ceifa commented Oct 12, 2026

Copy link
Copy Markdown

Fixes #88.

A loaded palette can be full by slot count while containing duplicate block states. In addPresetValuesWithEntries, the combined unique-state count may therefore fit the current bit width even though a preset is missing. The unconditional break skips insertion. Packet obfuscation later attempts to add that preset with PaletteResize.noResizeExpected() and crashes.

Move break inside the explicit-resize branch. Otherwise, let idFor insert missing presets using the container's actual resize callback. The explicit-resize path is unchanged.

Regression coverage

  • Added a standalone test that extracts the actual mixin method and runs it against a duplicate-slot palette model. The original method fails four of ten cases; this change passes all ten. The test runs in the existing build workflow with Java 25.
  • :fabric:build passes with Eclipse Temurin 25.
  • Separately tested the real Minecraft 26.3 / Fabric 0.19.5 packet path with Lithium 0.26.2, C2ME 0.4.2-alpha.0.90, and fresh private world copies. Both modes 1 and 3 crash with the original method. With this change, all 1,681 chunk packets per mode complete AntiXray's asynchronous preparation without a palette exception. Integration results.

The committed harness tests the algorithm, not mixin application or block-storage remapping. The separate integration probe tests actual packet construction and readiness, but not client decoding, network delivery, or prolonged gameplay. World files, player data, private coordinates and raw logs are not included.

@DrexHD

DrexHD commented Oct 16, 2026

Copy link
Copy Markdown
Owner

Thanks for providing some insights into the issue, I have manually applied the fix now!

@DrexHD DrexHD closed this Oct 16, 2026
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.

Crash whit Lithium

2 participants