Items can use more than name to pass their original id to client for resource packs#1217
Draft
mfishma wants to merge 2 commits intoViaVersion:masterfrom
Draft
Items can use more than name to pass their original id to client for resource packs#1217mfishma wants to merge 2 commits intoViaVersion:masterfrom
mfishma wants to merge 2 commits intoViaVersion:masterfrom
Conversation
added config with explanation,. Populating custom_model_data for 1.21.4+ clients for the resource pack to work better. Not passing this back in to server.
kennytv
requested changes
Feb 28, 2026
...src/main/java/com/viaversion/viabackwards/api/rewriters/BackwardsStructuredItemRewriter.java
Show resolved
Hide resolved
...src/main/java/com/viaversion/viabackwards/api/rewriters/BackwardsStructuredItemRewriter.java
Outdated
Show resolved
Hide resolved
Author
|
Discovered one issue. If an item's mapped twice through the downgrade process, both items are injected, and we just want one. I'll fix that before submitting again. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an opt-out configuration (
pass-original-item-name-to-resource-packs) that allows 1.21.4+ clients to clearly identify downgraded items beyond relying on fragilecustom_namematching.When an item is downgraded (e.g.,
minecraft:copper_axe), ViaBackwards appends its original unmapped item identifier to thestringsarray in theminecraft:custom_model_datacomponent. By putting it here rather than completely overriding theitem_modelcomponent, this ensures zero disruption to existing server resource packs or logic.To prevent polluting server-bound packets, a temporary
injected_cmd_stringtracking tag is added to thecustom_datapayload, allowing ViaBackwards to strip any injected string before forwarding the item packet back to the server.Resource pack development
Resource packs can now natively target downgraded items using vanilla
minecraft:selectconditions on thecustom_model_dataproperty, completely ignoring localized names or user renaming.Example
iron_axe.jsonfallback definition:{ "model": { "type": "minecraft:select", "property": "minecraft:custom_model_data", "index": 0, "cases": [ { "when": "minecraft:copper_axe", "model": { "type": "minecraft:model", "model": "myresourcepack:item/copper_axe" } } ] } }Note: There is potential conflict with other mods that might use
custom_model_data. When using modpacks and custom items, server owners should base them off items that were in the game before 1.21.4.