Posted April 18, 201411 yr 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.
April 18, 201411 yr 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
April 18, 201411 yr Author Thanks! Im going to try this right now. I just hope the methods are still similar because 1.7 changed a lot of this stuff. EDIT: Thanks so much! it works great!!!
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.