O'Reilly logo

Minecraft™ Mod Development in 24 Hours, Sams Teach Yourself by Jimmy Koene

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required