Skip to content

fix(26.2): open the editor on modded chest grids of any width - #13

Open
JosueM1109 wants to merge 1 commit into
marcsanz-dev:mainfrom
JosueM1109:fix/26.2-modded-chest-grids
Open

JosueM1109 wants to merge 1 commit into
marcsanz-dev:mainfrom
JosueM1109:fix/26.2-modded-chest-grids

Conversation

@JosueM1109

@JosueM1109 JosueM1109 commented Nov 24, 2026 •

Copy link
Copy Markdown

Modded chests that open their own screen class never showed the editor, because it only attaches to vanilla chest screens. Bigger modded chests also broke the grid math, which assumed 9 columns everywhere. I ran into this with Iron Chests on a Fabric 26.2 server, where the larger tiers are 12 and 14 slots wide (up to 126 slots).

Changes (multiloader-26.2 only)

  • Detection: a modded screen gets the editor when its container slots form one grid of 27 or more slots and the block entity can hold whitelists. Vanilla ContainerScreen handling is unchanged.
  • Grid width: ChestConfigManager gets gridColumns, gridRow and gridCol, and the editor, drag and preview code use them in place of the hardcoded 9.
  • Player keys: PLAYER_KEY_OFFSET goes from 117 to 1008. With a 126 slot chest, slots 117 to 125 were read as player inventory keys. These keys only live in memory, so nothing saved changes.
  • Presets: chests that are not 9 wide save presets under their own name (chest_preset_108x12_N.json), so a 12 wide preset never loads into a 9 wide chest.
  • Layout: on tall chests the toolbar moves into a column to the left of the GUI when it would go off screen above it. On wide chests the left panel shrinks to fit beside the GUI (80 px minimum).

Testing

  • :common:test passes (37 tests), including a new GridColumnsTest for the 9, 12 and 14 wide math.
  • In game on Fabric 26.2 with Iron Chests 2.0.8: the editor opens on every tier (copper to netherite). A slot whitelisted for diamonds takes a shift-clicked diamond and andesite skips it, in a vanilla chest and in gold, diamond and netherite chests (including netherite slot 120). Vanilla chests look and behave the same as before.
  • Not tested yet: drawing separators by hand in the bigger chests. I only had scripted input on the test machine.

Happy to split this up or change the approach if you'd rather handle modded screens another way.

Modded chests that use their own screen (Iron Chests and similar) never
got the editor, and the grid math assumed every chest is 9 slots wide.

- Detect modded chest screens by shape: one grid of 27 or more slots
  from a container that can store whitelists. Vanilla screens are
  matched as before.
- Read the grid width from the open chest (9, 12, 14, ...) instead of
  a fixed 9 in ChestConfigManager and the editor.
- Start player inventory keys at 1008 instead of 117 so a 126 slot
  chest does not overlap them (in memory only, no saved data changes).
- Keep presets for non 9 wide chests in their own files.
- Tall chests: move the toolbar into a column left of the GUI when it
  does not fit above. Wide chests: shrink the left panel to the space
  beside the GUI.
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.

1 participant