package ru.qlcreations.exile_z.player.gui;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderItem;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;
import ru.qlcreations.exile_z.player.specifications.PlayerEventHandler;
@Mod.EventBusSubscriber
public class PlayerHealth {
private Minecraft mc = Minecraft.getMinecraft();
private FontRenderer fontRenderer = mc.fontRenderer;
private ScaledResolution res;
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onRenderGameOverlay(RenderGameOverlayEvent.Text event) {
if (mc.world != null && mc.currentScreen == null) {
res = new ScaledResolution(mc);
int screenWidth = res.getScaledWidth();
int screenHeight = res.getScaledHeight();
int textWidth = fontRenderer.getStringWidth("Rad + 1000");
int textHeight = fontRenderer.FONT_HEIGHT;
int textX = screenWidth - textWidth - 5;
int textY = screenHeight - textHeight - 5;
fontRenderer.drawString("Rad " + PlayerEventHandler.getRadCounter(), textX, textY - 20, 0xFFFFFF);
ResourceLocation backgroundBars = new ResourceLocation("exile_z", "textures/overlay/background_bars.png");
mc.getTextureManager().bindTexture(backgroundBars);
mc.renderEngine.bindTexture(backgroundBars);
drawTexturedModalRect(textX - 40, textY - 30, 0, 0, textWidth + 50, textHeight + 40);
ResourceLocation hpBar = new ResourceLocation("exile_z", "textures/overlay/hp_bar.png");
mc.getTextureManager().bindTexture(hpBar);
mc.renderEngine.bindTexture(hpBar);
drawTexturedModalRect(textX - 28, textY + 4, 0, 0, textWidth + 30, textHeight);
ResourceLocation hp = new ResourceLocation("exile_z", "textures/overlay/hp.png");
mc.getTextureManager().bindTexture(hp);
mc.renderEngine.bindTexture(hp);
drawTexturedModalRect(textX, textY +555555, 0, 0, textWidth + 60, textHeight + 40);
ResourceLocation hpIcon = new ResourceLocation("exile_z", "textures/overlay/hpicon.png");
mc.getTextureManager().bindTexture(hpIcon);
mc.renderEngine.bindTexture(hpIcon);
drawTexturedModalRect(textX - 28, textY - 100, 0, 0, 32, 32);
}
}
private void drawTexturedModalRect(int x, int y, int textureX, int textureY, int width, int height) {
mc.ingameGUI.drawTexturedModalRect(x, y, textureX, textureY, width, height);
}
}