Skip to content

Fix equipment not switching in MC 26.1 due to NBT format change#165

Merged
sleepingdragoninn merged 1 commit into
sleepingdragoninn:26.1from
klao:fix-equipment-switching
May 25, 2026
Merged

Fix equipment not switching in MC 26.1 due to NBT format change#165
sleepingdragoninn merged 1 commit into
sleepingdragoninn:26.1from
klao:fix-equipment-switching

Conversation

@klao
Copy link
Copy Markdown

@klao klao commented May 18, 2026

Minecraft 25w06a (before 1.21.5) moved armor/offhand out of the Inventory array (slot indices 100-103 and -106) into a new equipment compound tag. This change adds a new equipment component type with an unbounded-map codec that handles the {slotName -> ItemStack} compound format.

I have tested this with a Fabric server on 26.1.2.

This fixes #164

@sleepingdragoninn
Copy link
Copy Markdown
Owner

Looks good, could you send a screenshot of the preview while full and empty?

Minecraft 25w06a (before 1.21.5) moved armor/offhand out of the Inventory array
(slot indices 100-103 and -106) into a new `equipment` compound tag. This change
adds a new `equipment` component type with an unbounded-map codec that handles
the {slotName -> ItemStack} compound format.

Fixes sleepingdragoninn#164
@klao klao force-pushed the fix-equipment-switching branch from 2b9af48 to 18f2bf6 Compare May 22, 2026 15:26
@klao
Copy link
Copy Markdown
Author

klao commented May 22, 2026

It's good you asked, because it didn't actually work with empty equipment! (I only tested it with different equipment in two profiles.)

It was a doozy to fix, and in the process I changed what NbtSwitcher.read() returns for a missing path. If you prefer, I can instead add a new flag to the JSON which enables this. Or, alternatively, just make "equipment" into a static component with its own read.

@klao
Copy link
Copy Markdown
Author

klao commented May 22, 2026

Here are the screenshots.

With equipment:
Equipment
Equipment hover

Switching to a profile with no equipment:
No equipment
No equipment view

@sleepingdragoninn
Copy link
Copy Markdown
Owner

cheers!

@sleepingdragoninn sleepingdragoninn merged commit 68e7d99 into sleepingdragoninn:26.1 May 25, 2026
@klao klao deleted the fix-equipment-switching branch May 25, 2026 13:47
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