[ Tutorial ] Custom Model Data ( Dynamically Change Item Textures! )

Started by Rug123 on Mon, 04/26/2021 - 14:31

Topic category: User side tutorials

Last seen on 13:32, 16. Jun 2021
Joined Feb 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
[ Tutorial ] Custom Model Data ( Dynamically Change Item Textures! )
Thu, 05/20/2021 - 09:43 (edited)

Welcome to this tutorial :D!

We first need to change our items json model to use custom model data

Go to your resources/assets/"MODID"/models/item/"ITEM MODEL"

In this case, im using amethyst.json

Open it using notepad and you should see something like this :

{
  "parent": "item/generated",
  "textures": {
    "layer0": "'MODID':items/'ITEM TEXTURE'"
  } 

}

Add this to the json model:
 

,
    "overrides": [
        { "predicate": { "custom_model_data": 1}, "model": "'MODID':item/'ITEM TEXTURE'custommodeldatafolder/1" },

        { "predicate": { "custom_model_data": 2}, "model": "'MODID':item/'ITEM TEXTURE'custommodeldatafolder/2" },

        { "predicate": { "custom_model_data": 3}, "model": "'MODID':item/'ITEM TEXTURE'custommodeldatafolder/3" },

        { "predicate": { "custom_model_data": 4}, "model": "'MODID':item/'ITEM TEXTURE'custommodeldatafolder/4" },

        { "predicate": { "custom_model_data": 5}, "model": "'MODID':item/'ITEM TEXTURE'custommodeldatafolder/5" },

        { "predicate": { "custom_model_data": 6}, "model": "'MODID':item/'ITEM TEXTURE'custommodeldatafolder/6" },

        { "predicate": { "custom_model_data": 7}, "model": "'MODID':item/'ITEM TEXTURE'custommodeldatafolder/7" }
  ]

it should look like this:

{
  "parent": "item/generated",
  "textures": {
    "layer0": "'MODID':items/'ITEM TEXTURE'"
  } ,
    "overrides": [
        { "predicate": { "custom_model_data": 1}, "model": "'MODID':item/'ITEM TEXTURE'custommodeldatafolder/1" },

        { "predicate": { "custom_model_data": 2}, "model": "'MODID':item/'ITEM TEXTURE'custommodeldatafolder/2" },

        { "predicate": { "custom_model_data": 3}, "model": "'MODID':item/'ITEM TEXTURE'custommodeldatafolder/3" },

        { "predicate": { "custom_model_data": 4}, "model": "'MODID':item/'ITEM TEXTURE'custommodeldatafolder/4" },

        { "predicate": { "custom_model_data": 5}, "model": "'MODID':item/'ITEM TEXTURE'custommodeldatafolder/5" },

        { "predicate": { "custom_model_data": 6}, "model": "'MODID':item/'ITEM TEXTURE'custommodeldatafolder/6" },

        { "predicate": { "custom_model_data": 7}, "model": "'MODID':item/'ITEM TEXTURE'custommodeldatafolder/7" }
  ]

}

Now make a folder in  resources/assets/"MODID"/models/item/ named 'ITEM TEXTURE'custommodeldatafolder

Add your item models inside that folder named 1/2/3/4/5/6/7 depending on your custom model

Now to change the custom model data of an itemstack :D

add this block to your procedure:

Set Number NBT Tag "CustomModelData" of *Itemstack* to 1

 

 

 

 

 

 

Andd your done :D 

if you want to have more than 7 custom model datas, just add

,

        { "predicate": { "custom_model_data":'NUMBER'}, "model": "'MODID':item/'ITEM TEXTURE'custommodeldatafolder/'NUMBER'" }

and so on

Edited by Rug123 on Thu, 05/20/2021 - 09:43
Last seen on 04:17, 14. Jun 2021
Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Can you provide some…
Sun, 05/09/2021 - 21:58

Can you provide some screenshots please? I honestly do not understand some naming stuff.

Last seen on 05:48, 11. May 2021
Joined Apr 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Coo le
Mon, 05/10/2021 - 04:05

Coo le

Last seen on 05:47, 30. May 2021
Joined Jan 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Thank you so much!
Mon, 05/10/2021 - 12:48

Thank you so much!

Last seen on 02:36, 15. Jun 2021
Joined Apr 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
This just turns my item into…
Sat, 05/22/2021 - 05:12

This just turns my item into an untextured cube.......

Last seen on 02:36, 15. Jun 2021
Joined Apr 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
What should the code of the…
Sat, 05/22/2021 - 05:42

What should the code of the custom model data models look like?

Last seen on 02:36, 15. Jun 2021
Joined Apr 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
I solved my issue, don't…
Sat, 05/22/2021 - 06:22

I solved my issue, don't create a separate folder for the custom models, just put them in the same folder as the main item and have the json of the main item use the directory, just call the models something like [itemname]_1 (_2,_3, etc.) instead.