Jump to content

[Unsolved] [1.9] Get point on model inside GUI


Wurmatron

Recommended Posts

I am trying to get the location of where the mouse clicked on my the players model when the mouse has clicked. I know i need to use the mouseRelease method but i how no idea other than that. Any ideas on how to proceed about this would be helpful.



    int xPos = (this.width) / 2;
    int yPos = (this.height) / 2;

    GL11.glPushMatrix();
    GL11.glColor3f(1F, 1F, 1F);
    GL11.glEnable(32826);
    GL11.glEnable(2903);
    GL11.glPushMatrix();
    GL11.glTranslatef(xPos + 40, yPos + 98, 50F);
    // Makes the scaling easier gui
    GL11.glScalef(-75, 75, 75);
    GL11.glRotatef(180F, 0.0F, 0.0F, 1F);
    GL11.glRotatef(135F, 0.0F, 1F, 0.0F);
    RenderHelper.enableStandardItemLighting();
    GL11.glRotatef(-135F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(0.0F, 1.0F, 0.0F, 0.0F);
    playerSP.renderYawOffset = playerSP.rotationYaw = playerSP.prevRotationYaw = playerSP.prevRotationYawHead = playerSP.rotationYawHead;
    playerSP.rotationPitch = 0.0F;
    GL11.glTranslatef(0.0F, playerSP.renderOffsetY, 0.0F);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    // scale by default is 1f
    GlStateManager.scale(scale, scale, scale);
    GL11.glRotatef(yaw, 0, 1, 0);
    // Used to render the player to the gui along with rotations
    Minecraft.getMinecraft().getRenderManager().doRenderEntity(playerSP, 0.0D, 0.0D, 0.0D, yaw, 1f, false);
    GL11.glRotatef(pitch, 0, 0, 1);
    GL11.glPopMatrix();
    RenderHelper.disableStandardItemLighting();
    GL11.glDisable(32826);
    GL11.glTranslatef(0F, 0F, 0.0F);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glEnable(32826);
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240 / 1.0F, 240 / 1.0F);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(32826);
    RenderHelper.disableStandardItemLighting();
    GL11.glDisable(2896);
    GL11.glDisable(2929);
    GL11.glPopMatrix();
[/Code]

 

 

Full Source: [font=verdana][size=78%]https://gist.github.com/Wurmatron/9c66c89489b4d5204f91c76e5dbb7fae[/size][/font]

- Wurmatron

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



×
×
  • Create New...

Important Information

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