Let’s go into a bit more detail how the JSON files in your asset folders are constituted. The first thing we’ll take a look at is the ResourceLocation
class.
The ResourceLocation Class
ResourceLocation resourceLocation = new ResourceLocation(TutorialMod.MOD_ID, "amethyst");
As you can see in the example code above, a ResourceLocation
is made of two parts: our Mod Id (which the ResourceLocation
calls namespace) and a path which in this case is the simple String "amethyst"
.
It’s also important to note that there can be something between the namespace and the path:
assets/<namespace>/<ctx>/<path>
with ctx
being a context-specific path depending on where the ResourceLocation
is used. The ResourceLocation
also has a different representation namely:
tutorialmod:item/amethyst
The idea is <namespace>:<path>
. In the above case with the specific context as well. This is exactly what we’ve seen inside the model JSON files before. I said they are directories and that’s right, but to say they point towards a ResourceLocation
is even more correct.
By the way, if no namespace was given, the ResourceLocation
defaults to "minecraft"
. You can give the short article on the official forge documentation another read, which contains a bit more context for ResourceLocation
.
Same JSON files, new Understanding
At the example of the Amethyst Ore JSON files we’re gonna see how the JSON files relate to the directories:
In the above image I have color- and number-coded each of the JSON files to their respective directories. After understanding the ResourceLocation
this should make a lot of sense!
I’ll give another textual explanation. The blockstates JSON can “point” to different block model JSONS. In our case it only points to one of the models, but pretty you should realize pretty quickly that if we can point to different block models than we could change textures when something (blockstate properties) on the block change. We’ll discuss the blockstates properties in a future article/video.
Knowing the blockstates JSON points to the block model, where does the block model JSON point to then? It points to one or more textures. Once again in our example the Amethyst Ore has the same texture on all six sides. This can be customized and we’ll see this also in a future article/video.
If we have a “default” item model for our block then that simply points back to the block model JSON which is then displayed inside the Inventory.
Here is another Simple Overview in how the JSON files relate to each other:
Summary
Hopefully both the ResourceLocation
and the JSON files now make more sense. If any Questions remain please feel free to comment on here or on the YouTube video. Also don’t forget to follow me on Socials and check out my YouTube Channel for videos as well.
Download the Cheat Sheets
SIMPLE OVERVIEW: https://url.kaupenjoe.net/yt10/json1
COLORED OVERVIEW: https://url.kaupenjoe.net/yt10/json2
Was this helpful?
11 / 1
[…] custom recipes to Minecraft is once again a fairly easy feat. It simply requires us to make another JSON file and that’s what we’re gonna do […]