Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

 

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

  • 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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.