Tutorial 16. Multi Textured Block

Before you read, make sure you have seen the previous tutorial

Code is on github

So, if you want your texture to have more than one texture, aka different textures on different sides, you need a little workaround.

So, in tutorial 3 we made a block. Lets use that as base.

Textures are stored as IIcons. Therfor, lets create a new array of IIcons, and set the size of that. Textures are only important on client side!

Ok, lets register those IIcons.
Remenber we did this earlier in BlockMcModTutorial. We’re gonna do the same, but this time we add a suffix. For every Icon in our IIcon array, register the icon with a different suffix.

In this example, my textures will be called testBlock1.png etc.
You could also change the names in the switch statment to for example top and bottom.

Forge also needs to know what texture to put on a side, therefor we will help forge a bit.

So, on side 0, stick the 0 th index in our IIcon array.
Do that for all sides. If something weird happens, just return the 0 th index.

That was pretty darn easy ;)

Back to List

Next tutorial

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">