Multi-Texturing Blocks

Multi-Texturing is a very common technique in Minecraft, as well as just about every game out there. Using it, a programmer can assign different textures to different faces of a model either through a modelling program like Blender, that uses UV editing, or in code. Minecraft operates on the latter and uses modified model files to accomplish this.

Overview
Multi-texturing isn't as hard as you think. We'll only be working with '.json' files, so there's no need to create new packages or classes. To accomplish multi-texturing we are going to:
 * Edit some of the code from the block creation tutorial
 * Import textures and assign them to different faces based on a parent model

Importing the Textures
The first thing you need is, obviously, the textures you want to put on your block. Create as many as you want, but remember that a cube has six faces. The textures should follow the standard format of 16 x 16 pixels, in '.png' format. This '.png' format is very important if you plan on adding transparency to your model, like leaves. Save your files to the regular directory of: /src/main/resources/assets//textures/blocks

Applying the Textures to the Block
This can get rather confusing, so be careful and make sure you're putting everything in the right place.

How block normals work
You can think of normals as the different variants, stages, or versions of a texture on the block. You can create as many as you want. However if you want them animate or change in-game, you'll want to create an entirely new Json file. These Json files are implemented into a blockstate Json file where they are applied to the block and can be changed. This may seem confusing, but I will explain it in my future tutorial on animating models.

Editing the world model for the block
If you recall in the block creation tutorial, we assigned the block to use the same texture on all of its faces: {   "parent": "block/cube_all", "textures": { "all": ":blocks/ " } }

Basically what this line does is it finds the specific image located within the mod (modID) and the folder 'blocks' inside said mod. It then textures the six faces with that image (image name), using the"cube_all" parent and the "all" keyword. Thicccs is nice, but how would we go about specifying each face and the image to match? Well, in order to do that, you need to understand parent blocks.

Parent blocks are blocks that are used as references for the game to work off of when texturing blocks from a mod. A parent block can be any of the blocks in the Referenced Libraries > ForgeSrc > assets > minecraft > models > block package. All you need to do is create a new text file in the assets. > models > block package of your mod (you should see a connection there), and paste the code from the game into your new file. You will also have to edit some things inside the file: Let's say, for example, that I have a new block and the textures for it. I want to make this block behave like a furnace, so I'll take the Json code from the furnace model in the game directory and paste it into my mod file, so I should have this: {   "parent": "block/orientable", "textures": { "top": "blocks/furnace_top", "front": "blocks/furnace_front_off", "side": "blocks/furnace_side" } } Now, I'll change the parent to "furnace." You'll see the "top," "front," and "side" keywords. These are the faces of the cube and the directories next to them are the textures in the game files. You can assign these textures to the faces however you want. Each block has a default set of faces and textures, but you can change any of them if you want. So I could change the "top", "front", and "side" faces however I wanted to the "up", "down", "north", "south", "west", or "east" faces. I could even add faces, as long as there is one texture for each of the six faces. Here is an example of a block with all custom faces:
 * 1) Choose the parent block you want
 * 2) Use the face layout copied from the game to decide which faces go where
 * 3) Save it as a .json file with whatever name you want in the mod directory mention above.

{   "parent": "block/bedrock", "textures": { "up": "tm:blocks/custom1", "down": "tm:blocks/custom2", "south": "tm:blocks/custom3", "north": "tm:blocks/custom4", "west": "tm:blocks/custom5", "east": "tm:blocks/custom6" } }

Creating the inventory model for the block
Now we need to go and define the inventory icon from the model we just made. We can do this by creating a new Json file in ' models > item ' and adding this bit of code to it: {   "parent": ":block/ ", "display": { "thirdperson": { "rotation": [ 10, -45, 170 ], "translation": [ 0, 1.5, -2.75 ], "scale": [ 0.375, 0.375, 0.375 ] }   } }

Setting up the blockstate
The final thing we have to do is create a blockstate that initializes the item and converts it into a dynamic entity, which is required for multi-texturing. Go to the blockstates package and create another Json file, and put this group of code inside it: {   "variants": { "normal": { "model": ": " } } } Basically this sets the model normals in the easiest way possible. This is just the beginning of what you can do with blockstates. You can add conditional statements to check if there are changes in the environment, gather NBT data, and many other things that I will talk about in my blockstates/metadata tutorial. This is one of the simplest things you can do, and it just checks to make sure the normals are correct and the lighting is decent on the model.

There you go! You can now add different textures to your models. Keep in mind that this only works for cube-shaped models. Check out my complex modelling tutorial to see how to make custom model and apply textures to those models, or my blockstates tutorial that demonstrates some of the things you can do with extra block data. Happy modding!