Jump to content

Recommended Posts

Posted

Hi

 

Yes there is.  Look in GuiContainer.drawScreen for inspiration, in particular this bit

        for (int j1 = 0; j1 < this.inventorySlots.inventorySlots.size(); ++j1)
        {
            Slot slot = (Slot)this.inventorySlots.inventorySlots.get(j1);
            this.drawSlotInventory(slot);

            if (this.isMouseOverSlot(slot, par1, par2) && slot.func_111238_b())
            {
                this.theSlot = slot;
                GL11.glDisable(GL11.GL_LIGHTING);
                GL11.glDisable(GL11.GL_DEPTH_TEST);
                int k1 = slot.xDisplayPosition;
                i1 = slot.yDisplayPosition;
                this.drawGradientRect(k1, i1, k1 + 16, i1 + 16, -2130706433, -2130706433);
                GL11.glEnable(GL11.GL_LIGHTING);
                GL11.glEnable(GL11.GL_DEPTH_TEST);
            }
        }

 

par1, par2 are mouseXpos and mouseYpos, which you can get from

            int k = Mouse.getX() * i / this.mc.displayWidth;
            int l = j - Mouse.getY() * j / this.mc.displayHeight - 1;

(this.mc is Minecraft).  inventorySlots has public access.  Need to check mc.currentScreen is actually the inventory container, of course.

 

You will need to do it on client because none of this exists on the server.

 

-TGG

Posted

One small question, what do I plugin for i and j when finding the mouse's position?

 

int k = Mouse.getX() * i / this.mc.displayWidth;
int l = j - Mouse.getY() * j / this.mc.displayHeight - 1;

Kain

Posted

Hi

 

Ah, yeah, I should have copied that too (from EntityRenderer.updateCameraAndRender)

 

            ScaledResolution scaledresolution = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight);
            int i = scaledresolution.getScaledWidth();
            int j = scaledresolution.getScaledHeight();
            int k = Mouse.getX() * i / this.mc.displayWidth;
            int l = j - Mouse.getY() * j / this.mc.displayHeight - 1;

 

-TGG

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.