Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort "custom_model_data" when merging resource packages. #66

Open
XXY233 opened this issue Aug 30, 2024 · 0 comments
Open

Sort "custom_model_data" when merging resource packages. #66

XXY233 opened this issue Aug 30, 2024 · 0 comments

Comments

@XXY233
Copy link

XXY233 commented Aug 30, 2024

"custom_model_data" should be sorted from smallest to largest when merging resource packs, otherwise minecraft will not handle the "custom_model_data" correctly, resulting in unexpected behavior.

Because I encountered strange behavior in the 1.20.4 client, the item NBT "custom_model_data" was 2200001. But it used the model "magic:wands/enchantedbook" instead of "slimefun:slimefun/gui/slimefun_guide".

(I used machine translation, so I'm sorry if there's any confusion.)

https://minecraft.wiki/w/Tutorials/Models#Item_predicates

Unsorted data
{
  "parent": "item/generated",
  "textures": { "layer0": "item/enchanted_book" },
  "overrides": [
    {
      "predicate": { "custom_model_data": 2200001 },
      "model": "slimefun:slimefun/gui/slimefun_guide"
    },
    {
      "predicate": { "custom_model_data": 2200003 },
      "model": "slimefun:slimefun/gui/back"
    },
    {
      "predicate": { "custom_model_data": 2200313 },
      "model": "slimefun:slimefun/magical_gadgets/knowledge_tome"
    },
    {
      "predicate": { "custom_model_data": 2200604 },
      "model": "infinityexpansion:materials/ender_flame"
    },
    {
      "predicate": { "custom_model_data": 2200605 },
      "model": "item/enchanted_book"
    },
    {
      "predicate": { "custom_model_data": 18001 },
      "model": "magic:wands/enchantedbook"
    }
  ]
}
Sorted data

{
  "parent": "minecraft:item/generated",
  "textures": { "layer0": "minecraft:item/enchanted_book" },
  "overrides": [
    {
      "predicate": { "custom_model_data": 18001 },
      "model": "magic:wands/enchantedbook"
    },
    {
      "predicate": { "custom_model_data": 2200001 },
      "model": "slimefun:slimefun/gui/slimefun_guide"
    },
    {
      "predicate": { "custom_model_data": 2200003 },
      "model": "slimefun:slimefun/gui/back"
    },
    {
      "predicate": { "custom_model_data": 2200313 },
      "model": "slimefun:slimefun/magical_gadgets/knowledge_tome"
    },
    {
      "predicate": { "custom_model_data": 2200604 },
      "model": "infinityexpansion:materials/ender_flame"
    },
    {
      "predicate": { "custom_model_data": 2200605 },
      "model": "item/enchanted_book"
    }
  ]
}

Edited:
This issue has been fixed in version 24w45a, previous versions are still affected: https://bugs.mojang.com/browse/MC-158872

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

No branches or pull requests

1 participant