Jump to content

Recommended Posts

Posted

As all the people that mess around with "Gui InGame" would know, that you can only get things to render to the right side of the screen easily (so when the player changes the screen size it stays in the same place) and I'm wondering if you're able to do the same thing but on the left side instead.

 

I mean so when you set a spot for the overlay on the left, it corresponds with the screen size so you don't just have a random overlay sitting in the middle of the screen when you're going in full screen.

 

Any help?

Former developer for DivineRPG, Pixelmon and now the maker of Essence of the Gods

Posted
@SubscribeEvent
public void tickEvent(RenderTickEvent event) {
	GuiIngame gig = mc.ingameGUI;
	FontRenderer font = mc.fontRendererObj;
	EntityPlayer player = mc.thePlayer;
	if(mc.currentScreen == null || mc.currentScreen instanceof GuiChat) {
		if(!mc.gameSettings.showDebugInfo) {
			if(SlayerAPI.BETA) mc.fontRendererObj.drawString(EnumChatFormatting.DARK_GREEN + "Essence of the Gods: " + EnumChatFormatting.DARK_RED + SlayerAPI.MOD_VERSION, 5, 5, 0);
			if(!player.capabilities.isCreativeMode) {
				mc.getTextureManager().bindTexture(new ResourceLocation(SlayerAPI.PREFIX + "textures/gui/playerStats.png"));
				float health = player.getHealth() * 5F;
				float hunger = player.getFoodStats().getFoodLevel() * 5F;
				float experience = (int)(mc.thePlayer.experience * 150F);
				float armor = player.getTotalArmorValue() * 5;
				float air = (float)player.getAir() / 1.5F / 2F;
				ScaledResolution res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
				int w = res.getScaledWidth() - 160, h = 10;
				GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
				GL11.glEnable(GL11.GL_BLEND);
				int lengthOfBar = 151;
				gig.drawTexturedModalRect(w - 10, h, 0, 0, lengthOfBar, 108 - 18);
				gig.drawTexturedModalRect(w - 10, h + 108 - 18, 0, 90, lengthOfBar, 18);
				gig.drawTexturedModalRect(w - 10, h + 108, 0, 235, 182, 18);

				gig.drawTexturedModalRect(w - 10, h, 0, 109, (int)(health * 1.5F), 18);
				gig.drawTexturedModalRect(w - 10 + 3, h + 3, 0, 199, 12, 11);

				gig.drawTexturedModalRect(w - 10, h + 18, 0, 127, (int)(hunger * 1.5F), 18);
				gig.drawTexturedModalRect(w - 10 + 3, h + 21, 0, 210, 12, 11);

				gig.drawTexturedModalRect(w - 10, h + 36 + 18 + 17, 0, 180, (int)(armor * 1.5F), 18);
				gig.drawTexturedModalRect(w - 10 + 3, h + 36 + 40, 17, 210, 9, 9);

				gig.drawTexturedModalRect(w - 10, h + 36 + 36 - 18, 0, 163, (int)(air * 2), 18);
				gig.drawTexturedModalRect(w - 10 + 3, h + 36 + 40 - 18, 17, 200, 9, 9);

				gig.drawTexturedModalRect(w - 10, h + 36, 0, 145, (int)experience, 18);
				GL11.glPushMatrix();
				GL11.glColor4f(0.4F, 1.0F, 0.3F, 1.0F);
				gig.drawTexturedModalRect(w - 10 + 3, h + 38, 0, 221, 14, 14);
				GL11.glPopMatrix();
				GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

				font.drawString(I18n.format("essence.healthbar", new Object[0]) + " " + health + "%", w - 10 + 20, h + 5, 0xFFFFFF);
				font.drawString(I18n.format("essence.hungerbar", new Object[0]) + " " + hunger + "%" , w - 10 + 20, h + 23, 0xFFFFFF);
				font.drawString(I18n.format("essence.armorbar", new Object[0]) + " " + armor + "%", w - 10 + 20, h + 36 + 23 + 18, 0xFFFFFF);
				if(player.getAir() <= 0) font.drawString(I18n.format("essence.airbar", new Object[0]) + " " + "0%" , w - 10 + 20, h + 36 - 18 + 42, 0xFFFFFF);
				else font.drawString(I18n.format("essence.airbar", new Object[0]) + " " + (int)air + "%" , w - 10 + 20, h + 36 - 18 + 42, 0xFFFFFF);
				font.drawString(I18n.format("essence.xpbar", new Object[0]) + " " + mc.thePlayer.experienceLevel , w - 10 + 20, h + 41, 0xFFFFFF);
				String st = I18n.format("essence.time", new Object[0]) + " " + formatTime(getWorldTime(mc));
				font.drawString(st, w - 10 + 3, h + 41 + 36 + 18, 0xFFFFFF);
				font.drawString(I18n.format("essence.coords", new Object[0]) + " X: " + (int)player.posX + ", Y: " + (int)(player.posY - 1) + ", Z: " + (int)player.posZ, w - 10 + 5, h + 36 + 78, 0xFFFFFF);
				GL11.glDisable(GL11.GL_BLEND);
			}
		}
	}
}

Former developer for DivineRPG, Pixelmon and now the maker of Essence of the Gods

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.