Jump to content

[1.8] Custom gui rendering


Failender

Recommended Posts

Alright. I know that I am missing something totally dumb.

I want to know something custom above the food icons of the player.

I know that I need to scale my rendering. But I am to dumb to get the math right now.

The y pos is always correct, the x pos gets messed up by changing the size of minecraft.

Any help is appreciated.

Greetz Failender

 

@SubscribeEvent
public void renderGui(RenderGameOverlayEvent event) {
	if(event.type==ElementType.ALL) {
		GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
		GL11.glDisable(GL11.GL_LIGHTING);
		ExtendedPlayer ext = ExtendedPlayer.get(Minecraft.getMinecraft().thePlayer);
		Minecraft.getMinecraft().getTextureManager().bindTexture(schild);
		int xPos = event.resolution.getScaledWidth()-205;
		int yPos = event.resolution.getScaledHeight()-48;

		float percentage = (float)ext.getCurrentShield()/ext.getMaxShield();
		drawTexturedModalRect(xPos, yPos, 0,  0,  16,  16);


	}

}

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.



×
×
  • Create New...

Important Information

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