Jump to content

Recommended Posts

Posted

I would like to see the a RenderHUDEvent that allows you to draw on the players in-game screen. I know there are methods which makes this possible but once you open a GUI it renders over that GUI as well. With a RenderHUDEvent your renders will render behind Gui's. See code below for implementation.

 

package net.minecraftforge.client.event;

import net.minecraft.client.Minecraft;
import net.minecraftforge.event.Event;

public class RenderHUDEvent extends Event {
        
        public final Minecraft mc;
        public final float partialTick;
        public final boolean guiOpen;
        public final int mouseX;
        public final int mouseY;
        
        public RenderHUDEvent(Minecraft mc, float partialTick, boolean guiOpen, int mouseX, int mouseY) {
                this.mc = mc;
                this.partialTick = partialTick;
                this.guiOpen = guiOpen;
                this.mouseX = mouseX;
                this.mouseY = mouseY;
        }
}

 

 

GuiIngame.java

if (this.mc.playerController.func_78763_f() && this.mc.thePlayer.experienceLevel > 0)
        {
            this.mc.mcProfiler.startSection("expLevel");
            flag1 = false;
            i1 = flag1 ? 16777215 : 8453920;
            String s = "" + this.mc.thePlayer.experienceLevel;
            j5 = (k - fontrenderer.getStringWidth(s)) / 2;
            k5 = l - 31 - 4;
            fontrenderer.drawString(s, j5 + 1, k5, 0);
            fontrenderer.drawString(s, j5 - 1, k5, 0);
            fontrenderer.drawString(s, j5, k5 + 1, 0);
            fontrenderer.drawString(s, j5, k5 - 1, 0);
            fontrenderer.drawString(s, j5, k5, i1);
            this.mc.mcProfiler.endSection();
        }

        MinecraftForge.EVENT_BUS.post(new RenderHUDEvent(this.mc, par1, par2, par3, par4));

        String s1;

        if (this.mc.gameSettings.heldItemTooltips)
        {
            this.mc.mcProfiler.startSection("toolHighlight");

            if (this.field_92017_k > 0 && this.field_92016_l != null)
            {

 

 

With use of Render Tick:

lNDyKTH.png

 

With use of RenderHUDEvent:

fuf3Edu.png

Posted

Just draw your stuff using a tick handler and the Tesselator. If you don't want it to draw over other Guis, check for this before drawing.

FMLClientHandler.instance().getClient().inGameHasFocus

If that returns false, don't draw your stuff. Simple.

Posted

Okay here are some pictures of what I mean with my "problem"

 

 

With use of Render Tick:

lNDyKTH.png

 

With use of RenderHUDEvent:

fuf3Edu.png

Posted

Okay here are some pictures of what I mean with my "problem"

 

 

With use of Render Tick:

lNDyKTH.png

 

With use of RenderHUDEvent:

fuf3Edu.png

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.