Jump to content

[1.7.2] Custom Inventory Slot Icon


delpi

Recommended Posts

I'm trying to figure out how to assign an empty slot of a container with a texture.

 

It looks like Forge added some stuff to the Slot to have the ability, but when I look at the GUI Container code that would utilize it, doesn't seem like it will work.

 

Anyone have any experience around this?

Long time Bukkit & Forge Programmer

Happy to try and help

Link to comment
Share on other sites

To the existing container?

I think the Container#addSlotToContainer will work.

For texture, use Slot#setBackgroundIcon.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

I found that, but if you trace out the GUI, when it gets that icon from slot, it will only use the standard Minecraft texturemap.

 

I don't see a way to point it at anything new. 

 

I got this to work for the normal helmet, chest ect.

 

I'm looking to do the same thing with a peice of custom armor.  It won't utilize anything but the standard 4.

 

Is this making sense?

Long time Bukkit & Forge Programmer

Happy to try and help

Link to comment
Share on other sites

The following is the relevant code where Slots are rendered.

 

That does not look like to me it is using whatever texture you input.  It is using the default minecraft items.png file.

 

Do you see it differently?

 

 


            IIcon iicon = p_146977_1_.getBackgroundIconIndex();

            if (iicon != null)
            {
                GL11.glDisable(GL11.GL_LIGHTING);
                this.mc.getTextureManager().bindTexture(TextureMap.locationItemsTexture);
                this.drawTexturedModelRectFromIcon(i, j, iicon, 16, 16);
                GL11.glEnable(GL11.GL_LIGHTING);
                flag1 = true;
            }

[/spoiler]

Long time Bukkit & Forge Programmer

Happy to try and help

Link to comment
Share on other sites

Then I think you have to register an icon via registerIcons.

I think it is similar with the item textures...

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

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.