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 Trying to get an Icon to register for my custom slot. Heres My Code (simplified it below):

Icon armorIcon;
@SideOnly(Side.CLIENT)
    public void registerIcons(IconRegister par1IconRegister) {
    	armorIcon = par1IconRegister.registerIcon("textures/items/slot_empty_boots.png");
    	
    }

    @SideOnly(Side.CLIENT)

    /**
     * Returns the icon index on items.png that is used as background image of the slot.
     */
    public Icon getBackgroundIconIndex()
    {
        return armorIcon;
    }

It turns out blank. Any help appreciated :P

Is the texture white, or transparent. Make sure that you put the texture in the right place. I think you need to put I in /mcp71/src/minecraft/textures/items/your file. The path you put in is the exact path from your zip or the src/minecraft/ folder.

    armorIcon = par1IconRegister.registerIcon("textures/items/slot_empty_boots.png");

 

That is not how you call registerIcon.

 

You're supposed to pass it a string in this format:

 

"MODNAME:ITEMNAME"

 

No .png, no full path.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Personally I like loading in the texture without an icon and just binding it. Not sure if there's a render item method however, but IMO that's much more manageable.

Check your error log.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

No crashes :/

 

Still check your logs. some errors don't neccessarily cause crashes.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

I believe slot backgrounds are considered items and not blocks.  Are you performing your registration as a block or as an item?

 

I had a similar problem and I had to create an item just to serve as the register for my slot backgrounds.

Sorry I wasn't clear.

 

You do put an Icon in the background of the container slot, it's just a matter of where you declare the icon you want to use.  Originally I was registering the icon in my chest Block and that just did not work.

 

Look at my mod project at:

 

https://github.com/dark2phoenix/RescueChest

 

I register the icon in dummy item I call ItemHotBar.  I then reference the icon I created in ItemHotBar when I'm creating my custom slot SlotHotBar.

 

See if that works for you.

Sorry I wasn't clear.

 

You do put an Icon in the background of the container slot, it's just a matter of where you declare the icon you want to use.  Originally I was registering the icon in my chest Block and that just did not work.

 

Look at my mod project at:

 

https://github.com/dark2phoenix/RescueChest

 

I register the icon in dummy item I call ItemHotBar.  I then reference the icon I created in ItemHotBar when I'm creating my custom slot SlotHotBar.

 

See if that works for you.

 

There's also another way on how to register an Icon, without needing an Item:

https://gist.github.com/SanAndreasP/380a80911debb88204c5

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

  • Author

Sorry I wasn't clear.

 

You do put an Icon in the background of the container slot, it's just a matter of where you declare the icon you want to use.  Originally I was registering the icon in my chest Block and that just did not work.

 

Look at my mod project at:

 

https://github.com/dark2phoenix/RescueChest

 

I register the icon in dummy item I call ItemHotBar.  I then reference the icon I created in ItemHotBar when I'm creating my custom slot SlotHotBar.

 

See if that works for you.

 

Thanks that worked!

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.