Jump to content

[1.7.2] Render Item Texture to Screen


Zebo1

Recommended Posts

I'm having trouble getting the texture of the current item selected in my hotbar and rendering it to the screen. I've tried several different methods but I can't seem to figure it out.

 

Every time I run the code (assuming it doesn't error out) it renders a random character instead of the texture (Like an "F" or an "%")

the IIcon variable is not null (tested with system.out.println(), it shows the correct item)

 

this.drawTexturedModelRectFromIcon(175, 175, this.mc.thePlayer.inventory.mainInventory[this.mc.thePlayer.inventory.currentItem].getIconIndex(), 16, 16);

 

(Code I was using to render to screen)

 

EDIT: ive also tried the forge wiki's tutorial on rendering 2d items to screen. It has the same result.

 

Link to comment
Share on other sites

Hi

 

It sounds like you are using the wrong texture sheet - you are rendering items using the character set texture sheet instead of the items texture sheet.  The location on the sheet is correct (corresponds to the item icon) but the texture image is the wrong one so you see characters instead of item icons.

 

Try

 

 texturemanager.bindTexture(texturemanager.getResourceLocation(itemStackToBeRendered.getItemSpriteNumber()));

 

(from 1.6.4 ItemRenderer.renderItem)

 

-TGG

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.