Basic Modding - Multi-texture Blocks


I want to show you how to create a block which has different textures on different sides.


3/10 - Relatively Easy


Forge Version

This Tutorial was created with Forge for Minecraft 1.7.10. If anything doesn't work with other versions, please contact me!

Creating a multitextured Block

The Block I want to create with you in this tutorial is a block which has six different textures for its six sides. Each texture has a different colour and the number of the side on it.


These are the textures I'll use:

The first thing we have to do is, of course, the creation of the block.

This is how the block's class should look like (of course you can change something like the creativeTab or the hardness or so):

package com.bedrockminer.tutorial.block;

import com.bedrockminer.tutorial.Main;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;

public class MultitextureBlock extends Block { 

    protected MultitextureBlock(String unlocalizedName, Material material) 
        this.setBlockTextureName(Main.MODID + ":" + unlocalizedName);

Normally a block has got only one texture which is mapped over all faces. But for our multitextured block we need some more textures. Therefore, we need an array of the interface "IIcon" which stores the textures.

public IIcon[] icons = new IIcon[6];

Once we have created the storage for the textures, we need to register the icons. To do this we press Alt+Shift+S and select "Override or Implement Methods". We want to override the method "registerBlockIcons".

This method gives us an IIconRegister as the argument. With this object we can register our Icons.

To do this the easiest way we create a for-loop which iterates six times to fill the six objects in the array.

public void registerBlockIcons(IIconRegister reg) {
    for (int i = 0; i < 6; i ++) {
        this.icons[i] = reg.registerIcon(this.textureName + "_" + i);

The Icons are registered as the textureName we set in the constructor followed by an underscore and the number of the face.

How does Minecraft Forge work - IIcon and IIconRegister:
The interface IIcon is used in Minecraft to get the texture for a block (or Item) on a specific face. The only two classes which implement this interface are TextureAtlasSprite and IconFlipped.
IIcon does not store the actual texture for the block, but the position of it on a texture map which is created by Minecraft on startup or when you change the texturepack. This texture map is created by the class TextureMap, better known as IIconRegister. TextureMap is the only class which implements this interface.

The texture map for both blocks and items is created after Forge's preInit call. On creation, the class calls every block's or item's registerBlockIcons() / registerIcons() method which registeres the icons and places them on the texture map.
The size of the texturemap is defined by the maximum picture size: The default size for the blocks' texture map is 256*256. If you have one and only one texture which is 32*32px, the whole texture map is scaled up to 512*512.

A block or item normally has got only one texture. this is stored in the protected field blockIcon/itemIcon.

Now we have created our Icons but we want them to be displayed on the block. Therefore, we need the method getIcon(). This method needs two arguments: First the side for the texture, then the blocks metadata.

In this tutorial I'll only cover the side value.


We override the method getIcon(int, int) into our block class.

The side can have values from 0 to 5, depending on the side which should be rendered. As the values can't be out of this range we can simply use our array without risking an ArrayIndexOutOfBoundsException.

public IIcon getIcon(int side, int meta) {
    return this.icons[side];

Now our block class is finished. The last thing to do is to register the block with the GameRegistry.

package com.bedrockminer.tutorial.block;

import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;

public final class ModBlocks {

    public static Block tutorialBlock;
    public static Block multitexture;

    public static final void init() {
        GameRegistry.registerBlock(tutorialBlock = new BasicBlock("tutorialBlock", Material.iron), "tutorialBlock");
        GameRegistry.registerBlock(multitexture = new MultitextureBlock("multitexture", Material.cloth), "multitexture");

Now, ensure that you have placed the textures from above in the appropriate package (assets.tutorial.textures.blocks) and also that you have named them properly (multitexture_0..5.png)

If you did this and start Minecraft now, you can see the new block in the Blocks-tab in creative mode.


One important thing about the basic blocks is that two faces (2 and 5 / Northern and Eastern) are rendered mirrored. Thats normally no problem but if you want to create textures which are supposed to be non-mirrored this can cause some problems.


The problem of the mirrored textures can also be seen with the block of TNT: Two faces have a mirrored N.

(You can see this if you take a look on the left side of the background image of my website in desktop mode)

Anyway, it seems that this problem has been solved with the latest update.

You can download the code used in this tutorial as a .zip file from here.

Recommended tutorials to continue with

Take a look at the tutorial overview and find out what you want to do next!

Comments and Questions:

If you want to report modding problems, please make sure to include the code in a pastebin link or something else! Don't just write "It doesn't work", otherwise your post will be deleted. For more complicated problems, please use the troubleshooter form.