Jump to content

Vanilla Textures on Custom Blocks


trulis

Recommended Posts

Block.name_of_block_you_want.getIcon(side, metadata)

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Try this in your custom block class:

    @Override
    public void registerIcons(IconRegister reg)
    {
    	this.blockIcon = reg.registerIcon("filename of the texture from the block you want");
    }

For the textures go to mcp/temp/bin/minecraft/textures/blocks

Press CRTL+SHIFT+O to import everything necessary.

↑↑↑↑↑↑↑↑↑↑ Click it please? :3 ↑↑↑↑↑↑↑↑↑↑

Link to comment
Share on other sites

Try this in your custom block class:

    @Override
    public void registerIcons(IconRegister reg)
    {
    	this.blockIcon = reg.registerIcon("filename of the texture from the block you want");
    }

For the textures go to mcp/temp/bin/minecraft/textures/blocks

Press CRTL+SHIFT+O to import everything necessary.

 

Bad bad bad bad.

 

This duplicates the icon in the sprite sheet, if you do it enough times you'll end up using up more texture memory.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

I'm trying to do this too, but with an item. What would I use for that? :P Items don't have sides, and I don't think meta changes the appearance either so that's also not relevant.

Item.blah.getIconFromDamage(meta);

 

RegisterIcon only accepts a string though, so I guess I need to use a different method to get my textures?

 

Also, is it possible to have one class for multiple items that does this, with a different texture per item? How would I differentiate the items, as they all have different IDs?

width=463 height=200

http://s13.postimg.org/z9mlly2av/siglogo.png[/img]

My mods (Links coming soon)

Cities | Roads | Remula | SilvaniaMod | MoreStats

Link to comment
Share on other sites

 

Bad bad bad bad.

 

This duplicates the icon in the sprite sheet, if you do it enough times you'll end up using up more texture memory.

That is not true.

 

He says while providing no evidence.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

He says while providing no evidence.

You did the same :P Look at the registerIcon implementation. It first looks up the icon name in a hashMap to see if an Icon instance for it already exists.

 

*Bow*

Touche.

 

I hadn't looked at the icon registration system, merely looked at what other blocks do.  For instance, grass references the Dirt class to get its bottom-face icon, rather than reregistering it.

 

So I had assumed that was the "more correct" way of doing things for whatever reason.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

I'm trying to do this too, but with an item. What would I use for that? :P Items don't have sides, and I don't think meta changes the appearance either so that's also not relevant.

Item.blah.getIconFromDamage(meta);

 

RegisterIcon only accepts a string though, so I guess I need to use a different method to get my textures?

 

Also, is it possible to have one class for multiple items that does this, with a different texture per item? How would I differentiate the items, as they all have different IDs?

No, like this:

public Icon getIconFromDamage(meta){
    return Item.blah.getIconFromDamage(meta); //or switch, if you want to differentiate between meta
}

No registration necessary.

BEWARE OF GOD

---

Co-author of Pentachoron Labs' SBFP Tech.

Link to comment
Share on other sites

  • Guest locked this topic
Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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