Basic Block-1.8.9

From McJty Modding
Jump to: navigation, search

In this document you learn how to do your first basic block. i.e. the simplest kind of block you can have: just a block that looks the same on all sides and does not have any other information. Note that this tutorial requires at least version 11.15.0.1673 of Forge to be able to use the new registry name feature.

public class FirstBlock extends Block {
    public FirstBlock() {
        super(Material.rock);
        setUnlocalizedName("firstblock");     // Used for localization (en_US.lang)
        setRegistryName("firstblock");        // The unique name (within your mod) that identifies this block
        GameRegistry.registerBlock(this);
    }
}

Then it is recommended you have some centralized place where you initialize all your blocks. It is common to call this ModBlocks. The static init in this class should be called from within CommonProxy.preInit:

public class ModBlocks {

    public static FirstBlock firstBlock;

    public static void init() {
        firstBlock = new FirstBlock();
    }
}

This block will look very ugly (default checkerboard model) and do nothing but it is the minimal example.