Jump to content

[1.7.10] Getting a block to look right in your inventory.


Recommended Posts

Posted

I've been fideling around with one of my block textures

 

(Heres the code for that:)

 

 

public IIcon getIcon(int side, int meta) {

if (side == 1) {

return this.iconTop;

} else if (side == 0) {

return this.iconTop;

} else if (side != meta) {

return this.blockIcon;

} return this.iconFace;

}

 

@SideOnly(Side.CLIENT)

public void registerBlockIcons(IIconRegister IconRegistry) {

this.blockIcon = IconRegistry.registerIcon(Constants.MODID + ":" + "chassisBlock");

this.iconFace = IconRegistry.registerIcon(Constants.MODID + ":" + "presserBlock_face");

this.iconTop = IconRegistry.registerIcon(Constants.MODID + ":" + "presserBlock_top");

}

 

 

 

It looks fine when placed in the world but looks different while in my inventory.

 

15rjprn.png

 

I kind of understand why it looks this way but I can't figure out how to fix it, and make it look like it does when placed.

I'm not trying to be rude it just comes out that way sometimes.

I'm here to try and learn as much as I can, won't you join me?

Posted

I changed it to this:

 

 

 

public IIcon getIcon(int side, int meta) {

if (side == 1) {

return this.iconTop;

} else if (side == 0) {

return this.iconTop;

} else if (meta == 0) {

return this.iconFace;

} else if (side != meta) {

return this.blockIcon;

} return this.iconFace;

}

 

@SideOnly(Side.CLIENT)

public void registerBlockIcons(IIconRegister IconRegistry) {

this.blockIcon = IconRegistry.registerIcon(Constants.MODID + ":" + "chassisBlock");

this.iconFace = IconRegistry.registerIcon(Constants.MODID + ":" + "presserBlock_face");

this.iconTop = IconRegistry.registerIcon(Constants.MODID + ":" + "presserBlock_top");

}

 

 

 

And got this as a result:

 

2pq43de.png

 

Fiddling around with it more couldn't produce anything better. :/

I'm not trying to be rude it just comes out that way sometimes.

I'm here to try and learn as much as I can, won't you join me?

Posted

 

That worked great thank you. :)

 

Hi

 

You might find the topics under "Item Rendering" useful

http://greyminecraftcoder.blogspot.com.au/p/list-of-topics.html

 

You could use an IItemRenderer, or alternatively an ISimpleBlockRenderingHandler (which might be easier).

 

These will let you rotate the block to face any way you choose

 

A quick google should shown you some tutorials

 

-TGG

 

 

 

That whole page looks like its going to be very helpful, thank you. :)

I'm not trying to be rude it just comes out that way sometimes.

I'm here to try and learn as much as I can, won't you join me?

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.