package gvclib.client.event;

import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.platform.Window;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.Options;
import net.minecraft.client.gui.Font;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.event.RenderGuiOverlayEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import org.lwjgl.opengl.GL11;

public class RenderHUD {
    @OnlyIn(Dist.CLIENT)
    @SubscribeEvent
    public void onEvent(RenderGuiOverlayEvent.Pre event) {
        Minecraft minecraft = Minecraft.getInstance();
        PoseStack poseStack = event.getPoseStack();
        Level world = minecraft.level;
        Window window = minecraft.getWindow();
        int i = window.getGuiScaledWidth();
        int j = window.getGuiScaledHeight();
        Player entityplayer = minecraft.player;
        ItemStack itemstack = ((Player) (entityplayer)).getMainHandItem();
        Font fontrenderer = minecraft.font;
        Options options = minecraft.options;

    //    ScaledResolution scaledresolution = new ScaledResolution(this.mc);

        poseStack.pushPose();//GL11.glPushMatrix();//guns
    //    GL11.glEnable(GL11.GL_BLEND);
     //   poseStack..glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    /*    GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA,
                GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE,
                GlStateManager.DestFactor.ZERO);
*/
        //String d4 = String.format("%1$3d", (int)minecraft.fpsString;
        fontrenderer.drawShadow(event.getPoseStack(),minecraft.fpsString, i - 80,  5, 0xFFFFFF);

        //String d5 = String.format("%1$3d", (int)this.mc.getDebugFPS());
      /*  String d5 = entityplayer.level.getBiomeManager().getBiome(minecraft.fpsString.).getBiomeForCoordsBody(c.getPosition()).getBiomeName();
        fontrenderer.drawShadow(event.getPoseStack(), d5, i - 40,  20, 0xFFFFFF);

        fontrenderer.drawShadow(event.getPoseStack(),"X:" + String.format("%1$3d", (int)entityplayer.posX), i - 40,  35, 0xFFFFFF);
        fontrenderer.drawShadow(event.getPoseStack(),"Y:" + String.format("%1$3d", (int)entityplayer.posY), i - 40,  50, 0xFFFFFF);
        fontrenderer.drawShadow(event.getPoseStack(),"Z:" + String.format("%1$3d", (int)entityplayer.posZ), i - 40,  65, 0xFFFFFF);
*/
        poseStack.popPose();//GL11.glPopMatrix();//gune
    }
}
