Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

One block different textures


Nomis
 Share

Recommended Posts

How do you have a Block class were you can select what texture you want? The getIcon method doesn't work. It will change all the types of the Block. I want them to be changed interdependently.

 

I hope you can help me :D

Author of the unreleased mod Factory Craft

I'm usually known as MnomisC

IGN MnomisC

Link to comment
Share on other sites

Hi

 

You need a  TileEntity with TileEntitySpecialRenderer for this. 

 

Alternatively, you can use a block with metadata.  That will let you choose from up to 16 different textures for each block, varied independently.

 

A quick google should find you a number of tutorials on both of these.

 

 

-TGG

Link to comment
Share on other sites

Every block location in the world not only stores the Block ID, but also a 2nd number, called metadata. For performance and memory reasons this number can only reach from 0 to 15 inclusive (16 states). It is used by e.g. the furnace, dispenser, etc. to store which direction it is facing, but you can use it for whatever you want.

 

You can set it by using world.setBlockMetadataWithNotify to set only the metadata or pass it to world.setBlock directly, together with the Block.

 

Then in the getIcon method of your Block you get 2 parameters, one of them is the metadata, read the javadoc to find out which. Then you can return different Icons based on the metadata.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.