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

Started by Rug123 on

Topic category: User side tutorials

Joined Feb 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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
Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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.

Joined Apr 2021
Points:

User statistics:

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

Coo le

Joined Jan 2020
Points:

User statistics:

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

Thank you so much!

Joined Apr 2021
Points:

User statistics:

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

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

Joined Apr 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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?

Joined Apr 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • 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.

Joined Aug 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hey @akisephila mind sharing…
Tue, 08/10/2021 - 12:37

Hey @akisephila mind sharing some screenshots?

Joined Oct 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thank you so much for this…
Mon, 08/16/2021 - 15:39

Thank you so much for this awesome tutorial :D
- Now I don't have to create multiple items for different textures.

Joined Mar 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
for me it just seems like it…
Mon, 10/18/2021 - 06:29

for me it just seems like it bounces in the air, as if you were to use an eye of ender

Joined Nov 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Can you make tutorail for…
Sun, 12/26/2021 - 09:50

Can you make tutorail for dynamicly changed textures FOR BLOCKS, plz?

Joined Feb 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
its not working for me all…
Sun, 07/09/2023 - 02:33

its not working for me all im getting is the missing texture cube, i have no idea what the problem is tho

Joined Mar 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
hey want to ask is it…
Sun, 02/25/2024 - 02:03

hey want to ask is it possible too load mutliple model ontop of each other or no?

Joined Aug 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Is there any way we can…
Wed, 11/27/2024 - 19:27

Is there any way we can apply this same principle to armor???