Adding Block Textures

As mentioned, you must do quite a few things to make multiple textures work. First, you must add new code for the removed setBlockTextureName line. To do this, you need an IIcon array, which stores the images of the blocks. One problem with IIcon is that it only exists on the client because the server doesn’t work with rendering things and, therefore, doesn’t require the image of a block. To make sure the variable is only created when the class is read in client mode, you must add the @SideOnly(Side.CLIENT) piece of code from the getSubBlocks method as well. With the annotation, the variable should look like the following:

@SideOnly(Side.CLIENT)private IIcon[] icons;

This IIcon array has to be filled with icons during initialization. ...

Get Minecraft™ Mod Development in 24 Hours, Sams Teach Yourself now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.