Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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

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.

  • Author

I tried pretty much everything to draw behind gui, but never got the right result.

  • Author

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

  • Author

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...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.