Introduction Edit

Welcome back! Today we'll be learning how to make a block in Minecraft 1.9! Here are the things we are going to do:

  • Init
  • Creating the block
  • Activating the scripts
  • Textures
  • Naming the block

Similar to the item you might think? Well, it's a little difference. Let's find out why.

Basic Blocks Edit

Init Edit

Just like the item, we need to create a new initiation class. Right click on the init folder we made in the item tutorial, and press new class. We are going to name this class InitBlocks. Press finish, and we're on our way!

In here, we're going to create five classes. The five classes will be listed below, then explained.


The first function we created is named Create(), because here we will be listing the properties of the block, as well as creating it. The second function we called Register(), because there it will register the block into the game. The third function called Render() is there to render both the block and the item. The fourth function we made, RegisterItem(), will register the item of the block, because there is the block, and then there is the item of the block. Finally, we made RegisterBlock() to register the block itself.

Now, we're going to create our first block. Right above the create function, but below the main class, type this...

public static Block test_block;

Import Block, and now we've created it. Well, not really, first we have to actually say what it is. Within our create function, we are going to type,

test_block = new test_block(Material.ROCK, "test_block", CreativeTabs.BUILDING_BLOCKS);

Ignore the errors at the moment. First, we put Material.ROCK. Here you can choose what material you would like your block to be. Then, we wrote the string test_block to let the game know that that is going to be the name of our block. Finally, we told it what creative tab we wanted to give it, whilst ending it with a semicolon.

Before we do anything else, don't forget we need to type Register(); below that line, that way it will run our Register() class.

Go ahead and hover over test_block, the second one, and press CREATE CLASS. Where it says package, we need to put in something like the below...

Go ahead and press finish, and now we're in our block. But you'll see there is an error on test_block once again. This is very simple to fix, just hover over it and press the top Add Constructor. Go ahead and remove the todo line, and now we are going to edit some things. Right after the variable Material materialIn, put a comma and type String name, and then put another comma and type CreativeTabs tab. Now, right after the line super(materialIn), type threethings: this.setRegistryName(Strings.MODID, name);, and after this type this.setUnlocalizedName(name);, and finally type this.setCreativeTab(tab);. Now we have finished our block, but there are some more things to do in our InitBlocks class. Make sure to save and import everything.

Now, within our ImportBlocks class, and under Register(), type the line below...


Now let's skip down to our RegisterBlock() function. First, within the brackes, type Block block. Now we are going to type two lines...


Here, we register the two things we needed to register, the Block and the Block's Item. Now, within our RegisterItem class, we are going to copy the line below from our InitItems class.

ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));

Now your whole initblocks class should look something like this...


There are only a couple more things to do now!

Within our Render() class, type this...


Here we have registered the item from the block, so that it will load the item texture as well as the blocks. Go ahead and save and import before we move on.

Great job! Now there are only a couple more things to do!

Activating the scripts Edit

Now we need to activate all of our scripts. Go inside of our mainregistery. Right below the line we did for items (InitItems.init();), we are going to type this... InitBlocks.Create(). Now that we've done that, let's jump inside of our ClientProxy. Right below the line we did for inititems here, type InitBlocks.Render(). Go ahead and save both of them. Now we are almost done! :D

Textures Edit

Now the textures for blocks are actually quite a bit more complicated than the textures for items. The first thing we need to do is right click on the tutorialmod folder we did in assets. Press new, folder. Name this folder blockstates. Right click on blockstates and press new file. Name this file test_block.json. Now, make sure you copy the exact line below, as we're going to edit some things.

    "variants": {
        "normal": { "model": "<MODNAME>:<NAME OF ITEM>"}

For us, we're going to replace MODNAME with tutorialmod, and replace NAME OF ITEM with test_block. Now, right click on the models folder we made in the items tutorial. Press new, folder. Name this folder block. Right click on block and press new file. Name this file test_block.json once again. This time, the code will be different.

    "parent": "block/cube_all",
    "textures": {
        "all": "<MODNAME>:blocks/<NAME OF ITEM>"

Once again we will replace MODNAME with tutorialmod and replace NAME OF ITEM with test_block. Now, within models/item folder we made, create a new file called test_block.json one last time. Put in the lines below...

    "parent": "<MODNAME>:block/<NAME OF ITEM>",
    "display": {
        "thirdperson": {
            "rotation": [ 10, -45, 170],
            "translation": [ 0, 1.5, -2.75 ],
            "scale": [ 0.375, 0.375, 0.375]

One last time, replace MODNAME with tutorialmod and replace NAME OF ITEM with test_block. Now the last thing for you to do is take your texture and put it in your textures folder!

Within your textures folder, make a new folder called blocks. In here you want to put your texture.

Naming the block Edit

The last thing to do is name the block! Under assets/tutorialmod/lang, we're going to edit the en_US.lang file we made last tutorial. Below the line we did, we're going to type... Block

As you already know, there cannot be any spaces between .name and the name of your block. Save the file, and you have completed creating a block!

Finishing Up Edit

We've created a whole block today! You should be proud of yourself, it used to be a lot easier in 1.7.10. Go ahead and click here to check my github if you need any review. Otherwise, click here to go back home and see some of our other tutorials!