Skip to content

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
mfishma:feature/custom_model_data
Draft

Items can use more than name to pass their original id to client for resource packs#1217
mfishma wants to merge 2 commits intoViaVersion:masterfrom
mfishma:feature/custom_model_data

Conversation

@mfishma
Copy link

@mfishma mfishma commented Feb 27, 2026

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 fragile custom_name matching.

When an item is downgraded (e.g., minecraft:copper_axe), ViaBackwards appends its original unmapped item identifier to the strings array in the minecraft:custom_model_data component. By putting it here rather than completely overriding the item_model component, this ensures zero disruption to existing server resource packs or logic.

To prevent polluting server-bound packets, a temporary injected_cmd_string tracking tag is added to the custom_data payload, 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:select conditions on the custom_model_data property, completely ignoring localized names or user renaming.

Example iron_axe.json fallback 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.

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.
@mfishma mfishma requested a review from kennytv March 2, 2026 01:26
@mfishma mfishma marked this pull request as draft March 3, 2026 00:16
@mfishma
Copy link
Author

mfishma commented Mar 3, 2026

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.

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