Skip to content

Apply resolvable default item components to every Item#6375

Open
eclipseisoffline wants to merge 7 commits into
GeyserMC:masterfrom
eclipseisoffline:resolvable-default-item-components
Open

Apply resolvable default item components to every Item#6375
eclipseisoffline wants to merge 7 commits into
GeyserMC:masterfrom
eclipseisoffline:resolvable-default-item-components

Conversation

@eclipseisoffline
Copy link
Copy Markdown
Member

@eclipseisoffline eclipseisoffline commented May 9, 2026

This PR refactors Geyser's ComponentCache/ResolvableComponent system to be applied to every Item instance, and not just NonVanillaItem instances. Since the only reason the NonVanillaItem class existed was to support the resolvable component system, this class has been removed.

Resolvable data components, or resolvable components for short, are data components that have to be resolved once a session has successfully configured. Usually, this is because the values of these components contain data-driven registries, and we (or rather, MCPL) stores the values as integer, network IDs. These network IDs can change for every session as the registry is data-driven/dynamic.

Geyser loads every item's default/standard data components at start-up, from a mappings file generated by the mappings generator. It does this by using MCPL's data component readers. The mappings file is generated using a vanilla datapack, and thus, the IDs MCPL is reading for resolvable components are only necessarily true for servers using that vanilla datapack. As such, these values can very quickly be wrong for servers having datapacks or modifying data-driven registries in other ways.

This was not a problem in Minecraft 1.21.11 and below, as Minecraft serialised these data-driven default item components using their identifier, and not their network ID (see: 1.21.11's EitherHolder).

The solution to this is simple: we already have a ResolvableComponent system in place for non-vanilla items, so this PR expands this system to apply to every item. Now, at startup, Geyser also reads a "resolvable components" mappings file, which contains identifiers of resolvable components, instead of network IDs. Then, whenever a session finishes the configuration stage, the resolvable components' respective MCPL values are read into the session's ComponentCache.

The mappings file is generated by a new generator in mappings-generator#94, the generated file is in mappings#116. This PR depends on both of those PRs.

The loading of the new mappings file has been tested, simple gameplay testing is still a TODO.

@eclipseisoffline eclipseisoffline changed the title Resolvable default item components Apply resolvable default item components to every Item May 9, 2026
Copy link
Copy Markdown
Member

@onebeastchris onebeastchris left a comment

Choose a reason for hiding this comment

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

I miss the times when item code was session agnostic :p

@onebeastchris onebeastchris added PR: Under Review When a PR (particularly a large one) is currently being reviewed to see if it can be merged PR: Feature When a PR implements a new feature labels May 12, 2026
@eclipseisoffline eclipseisoffline force-pushed the resolvable-default-item-components branch from 356eab8 to 340633a Compare May 12, 2026 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: Feature When a PR implements a new feature PR: Under Review When a PR (particularly a large one) is currently being reviewed to see if it can be merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants