@SubscribeEvent
@SideOnly(Side.CLIENT)
public void drawInGame(RenderGameOverlayEvent.Post event){
if(event.type == ElementType.ALL){
Minecraft mc = Minecraft.getMinecraft();
EntityClientPlayerMP player = mc.thePlayer;
RPGPlayerData info = RPGPlayerData.forPlayer(player);
if(info == null){
return;
}
int height = event.resolution.getScaledHeight();
int width = event.resolution.getScaledWidth();
GL11.glPushMatrix();
if(!player.capabilities.isCreativeMode){
GL11.glPushMatrix();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.9F);
GL11.glScaled(0.5, 0.5, 0);
mc.getTextureManager().bindTexture(new ResourceLocation(InMinecraftRpg.MOD_ID.toLowerCase(), "textures/gui/icons.png"));
int healthBarWidth = MathHelper.ceiling_float_int(((player.getHealth() / player.getMaxHealth()) * 163));
/* Draw health border */
mc.ingameGUI.drawTexturedModalRect(width / 2 + 29, height + 160, 0, 106, 163, 18);
/* Draw health bar */
mc.ingameGUI.drawTexturedModalRect(width / 2 + 29, height + 160, 0, 87, healthBarWidth, 18);
}
GL11.glPopMatrix();
}