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 was wondering how I could get an item's icon to display in a GUI. (Or a fake slot would work too, but I don't know how to do that either.)

Legend of Zelda Mod[updated September 20th to 3.1.1]

Extra Achievements(Minecraft 1.8!)[updated April 3rd to 2.3.0]

Fancy Cheeses[updated May 8th to 0.5.0]

Warning: This is only for 1.7.10.  I haven't figured out what the equivalent for 1.8 is yet.

 

You may want to draw the texture of an Item in a custom GuiScreen.  Items don't directly have a ResourceLocation for their texture. Instead, they have an IIcon object which holds the UV-coordinates of the texture on a giant image which holds all the Item textures.  The ResourceLocation is located at TextureMap.locationItemsTexture. If you want to use this in a GUI, you have to get the IIcon of the Item first, bind the TextureMap.locationItemsTexture, and then call the drawTexturedModelRectFromIcon() method to draw the IIcon of the item.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

  • Author

Warning: This is only for 1.7.10.  I haven't figured out what the equivalent for 1.8 is yet.

 

You may want to draw the texture of an Item in a custom GuiScreen.  Items don't directly have a ResourceLocation for their texture. Instead, they have an IIcon object which holds the UV-coordinates of the texture on a giant image which holds all the Item textures.  The ResourceLocation is located at TextureMap.locationItemsTexture. If you want to use this in a GUI, you have to get the IIcon of the Item first, bind the TextureMap.locationItemsTexture, and then call the drawTexturedModelRectFromIcon() method to draw the IIcon of the item.

 

So, something like this?

protected void guiDrawIcon(Item item, int x, int y) {
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
IIcon icon = item.getIconFromDamage(0);
GL11.glEnable(GL11.GL_BLEND);
this.drawTexturedModelRectFromIcon(x, y, icon, 16, 16);
GL11.glDisable(GL11.GL_BLEND);
}

Legend of Zelda Mod[updated September 20th to 3.1.1]

Extra Achievements(Minecraft 1.8!)[updated April 3rd to 2.3.0]

Fancy Cheeses[updated May 8th to 0.5.0]

If this doesn't work you can make an fake slot. Just simply create your own slotclass (extending Slot) and set the "isItemValid()" and "canTakeStack()" to false.(not sure if these are the exact methodes, but you'll have to add the right one anyway if you extend the Slot class)

Projects:

Discontinued:

- N2ConfigAPI

- Meachanical Crafting Table

 

Latest:

- CollectionUtils

 

Coöperations:

- InGameConfigManager

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.