Giter Club home page Giter Club logo

custom_model_data_guide's Introduction

Preface

Custom model data is a feature in Minecraft that allows you to create your own models for items.

Prep

To use custom model data, you need to make sure that all paths are set properly.
This means that the base model file with the CustomModelData declaration that points to a new model file must be in the same spot it would be in the vanilla datapack. (If you are not sure of where these would be, I suggest looking at mcassets or mcmeta) To create a custom model data, you first need to take the original model file and put it into your resource pack.
This must go into the vanilla namespace.
Then, create a new folder for your own assets within the assets directory. (for this example I'm going to name it custom_model_data_guide_assets.)
Within this folder, create the initial folders models, and textures, and an item folder within both of those.

Base Model

Open the original model file you're basing off of and add the following code after the textures declaration:

,
"overrides" : [
{ "predicate": { "custom_model_data": <data number> }, "model": "<namespace>:<path>" }
]


For this example, this looks like:

,
"overrides": [
    { "predicate": { "custom_model_data": 1 }, "model": "custom_model_data_guide_assets:item/uno_reverse_model" }
  ]

This code tells the game which model file to look for. The model file should be in the assets/<declared namespace>/models/<declared path> folder.
For example, if you have a model in models -> weapons -> swords -> basic -> iron -> noob_sword.json, it would look like "model": "your_namespace:weapons/swords/basic/iron/noob_sword".
You should also name your custom model data with a unique prefix number that makes sense to you to avoid conflicts with other custom model data packs.

New Model

Then, create a model file in the folder you declared in the previous step.
This is the json file that tells the game where to place and render the textures. In this file, you are telling the game which texture file(s) to look for.
You can create your own folder for this, and this will likely make it easier to find things if you are making a large pack.
If making your own folder, you will put it under the assets directory. For this demonstration I will be creating a directory called custom_model_data_guide_assets to put the models and textures into

This will be the model that you exported from blockbench/another software if you used one - or if you're just using a hand-made texture, you can make your own. I will be making my own for this demonstration - it looks like this:

{
  "parent": "minecraft:item/generated",
  "textures": {
    "layer0": "custom_model_data_guide_assets:item/uno_reverse_texture"
  }
}

This must be named and in the location that was declared in the override from earlier. So for this demonstration, this file must go into custom_model_data_guide_assets/models/item and then be named uno_reverse_model.json

Textures

The texture file(s) should be in the assets/<declared namespace>/textures/<declared path> folder. You can use assets that are already in the game or your own textures.
If you export a blockbench model file, you might need to manually adjust the texture file assignments in the case that it was not getting the files from the same place that you are getting them in the pack.
For this demonstration, the file must be in the custom_model_data_guide_assets/textures/item folder, and be named uno_reverse_texture

Final

You need an mcmeta file or your pack won't work. misode.github.io has a generator, as well as many other very helpful resources for data/resource packs.
The mcmeta must simply be named pack.mcmeta
If you want to include a pack image, it must be named pack.png

Other Notes

It's important to note that if you have multiple custom model data declarations on one item, you must declare them in numerical order or it will break.

It's not working!

Use your debug option on your launcher, it'll help a ton. It'll tell you exactly what's wrong.

  • It's not showing up at all, it just looks normal!

    • Your model data is either declared wrong, or your pack is not loading.
  • My item is just a huge broken box!

    • You declared the model data, but it's pointing to a broken model
  • My item looks right, but it's just the wrong/broken texture!

    • Check the texture declaration in your model. Make sure all paths are correct.
  • It's showing up with the wrong item!

    • Make sure you didn't either paste the wrong path, or use the wrong number, or accidentally add a zero/extra number somewhere
  • This item is supposed to look like x but it's not the right size!

    • Use blockbench to rescale/try using a different parent
  • I made a bow and it only changed the first texture!

    • You will need overrides for all the textures on the bow. I suggest getting someone more qualified to help with complex texture questions

custom_model_data_guide's People

Contributors

rhythmicsys avatar

Stargazers

LRCOMPANY avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.