Jump to content

[1.7.2]How to change block texture based on height


LogicTechCorp

Recommended Posts

The class Block has 2 methods that determine a block's icon.

 

getIcon(IBlockAccess world, int x, int y, int z, int side);
getIcon(int side, int meta);

 

The first method gets called in the world, and the second method gets called in inventories.

In the world you can just get the y level and return the texture you want, but you still have to implement the second method or let setTextureName(String) do it for you.

 

By default when the first method is called it automatically calls the second method, but in this case you have to override it.

Link to comment
Share on other sites

The class Block has 2 methods that determine a block's icon.

 

getIcon(IBlockAccess world, int x, int y, int z, int side);
getIcon(int side, int meta);

 

The first method gets called in the world, and the second method gets called in inventories.

In the world you can just get the y level and return the texture you want, but you still have to implement the second method or let setTextureName(String) do it for you.

 

By default when the first method is called it automatically calls the second method, but in this case you have to override it.

 

I know that will work with my own custom block but how would I use it with a vanilla block?

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.