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

Started by Rug123 on

Topic category: User side tutorials

Active 3 years ago
Joined Feb 2021
Points:
561

User statistics:

  • Modifications: 1
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 0
[ 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
Active 9 months ago
Joined Jun 2019
Points:
831

User statistics:

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

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

Active 3 years ago
Joined Apr 2021
Points:
538

User statistics:

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

Coo le

Active 2 years ago
Joined Jan 2020
Points:
625

User statistics:

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

Thank you so much!

Active 1 month ago
Joined Apr 2021
Points:
654

User statistics:

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

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

Active 1 month ago
Joined Apr 2021
Points:
654

User statistics:

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

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

Active 1 month ago
Joined Apr 2021
Points:
654

User statistics:

  • Modifications: 0
  • Forum topics: 18
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 68
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.

Active 3 years ago
Joined Aug 2021
Points:
488

User statistics:

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

Hey @akisephila mind sharing some screenshots?

Active 2 years ago
Joined Oct 2019
Points:
793

User statistics:

  • Modifications: 0
  • Forum topics: 11
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 210
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.

Active 3 months ago
Joined Mar 2015
Points:
800

User statistics:

  • Modifications: 4
  • Forum topics: 5
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 42
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

Active 7 months ago
Joined Nov 2020
Points:
784

User statistics:

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

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

Active 1 year ago
Joined Feb 2021
Points:
551

User statistics:

  • Modifications: 0
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 1
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

Active 1 month ago
Joined Mar 2023
Points:
192

User statistics:

  • Modifications: 0
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 8
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?

Active 4 weeks ago
Joined Aug 2024
Points:
51

User statistics:

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

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