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.

Having problems with Chat box overlaping / clearing HUD gui ingame graphics

Featured Replies

Posted

Been having a problem with this some time now. Normally it didn't really hurt anything however with a new hud I created the chat box is becoming problematic...

 

The Issue: If new text is placed in the chat box, all my render tick GUI elements get covered up. This is problematic when the Hud provides a resource pool. Below is my example:

 

*Normal*

asexampleguiproblem.png

 

*Chat covering up hud*

asexampleguiproblem2.png

 

The code I use (Relative to issue): ClientTickHandlerAsgardShield

 

 

public final class ClientTickHandlerAsgardShield implements ITickHandler
{
int ASGuardGuage = 0;
boolean ASGuardGuageGilded = false;

@Override
    public void tickStart(EnumSet<TickType> type, Object... tickData) {}

    @Override
    public void tickEnd(EnumSet<TickType> type, Object... tickData)
    {
        if (type.equals(EnumSet.of(TickType.RENDER)))
        {
            onRenderTick();
        }
        else if (type.equals(EnumSet.of(TickType.CLIENT)))
        {
            GuiScreen guiscreen = Minecraft.getMinecraft().currentScreen;
            if (guiscreen != null)
            {
                onTickInGUI(guiscreen);
            } else {
                onTickInGame();
            }
        }
    }

    @Override
    public EnumSet<TickType> ticks()
    {
        return EnumSet.of(TickType.RENDER, TickType.CLIENT);
        // In my testing only RENDER, CLIENT, & PLAYER did anything on the client side.
        // Read 'cpw.mods.fml.common.TickType.java' for a full list and description of available types
    }

    @Override
    public String getLabel() { return null; }


    public void onRenderTick()
    {
    	Minecraft mc = FMLClientHandler.instance().getClient();
    	if (mc.thePlayer == null || mc.theWorld == null) return;
    	{
    		EntityPlayer p = mc.thePlayer;
    	
    		//System.out.println("onRenderTick");
    		//TODO: Your Code Here
    		
    		//FMLClientHandler.instance().getClient().fontRenderer.drawStringWithShadow("VC "+ItemAsgardShield.asgardShieldVanguardCountI, 0, 0, 16777215);
    		
    		//Vanguard GUI
    		if (p.isBlocking() && ItemAsgardShield.asgardShieldActive == true && mc.playerController.isInCreativeMode() == false)
    		{
    			ScaledResolution var5 = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
    		    int var6 = var5.getScaledWidth();
    		    int var7 = var5.getScaledHeight();
    			int texture = mc.renderEngine.getTexture("/mod_AsgardShield/AsgardShieldTex/VCGauge.png");
    			mc.renderEngine.bindTexture(texture);
    			int VCCharge = (ItemAsgardShield.asgardShieldVanguardCountI * 16) - 16;
    			if(VCCharge < 0){VCCharge = 0;}
    			FMLClientHandler.instance().getClient().ingameGUI.drawTexturedModalRect(var6 / 2 - 8, var7 - 54, VCCharge, 0, 16, 16);
    		}
    		
    		//Guard Gauge GUI
    		if (mod_AsgardShield.guardGaugeActive == true && mc.playerController.isInCreativeMode() == false)
    		{
    			int var18;
    			int var26;
    			int total;
    			int gilded;
    			total = this.ASGuardGuage / 20;
    			if (this.ASGuardGuageGilded == true){gilded = 9;}else{gilded = 0;}
    			
    			for (int var25 = 0; var25 < 10 - total; ++var25)
                {
    				ScaledResolution var5 = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
    				int var6 = var5.getScaledWidth();
    				int var7 = var5.getScaledHeight();
    				int ggTexture = mc.renderEngine.getTexture("/mod_AsgardShield/AsgardShieldTex/GuardGauge.png");
    				mc.renderEngine.bindTexture(ggTexture);
    			
    				var18 = var6 / 2 + 82;
    				var26 = var18 - var25 * 8;
    				
    				FMLClientHandler.instance().getClient().ingameGUI.drawTexturedModalRect(var26, var7 - 49, gilded, 0, 9, 9);
                }
    		}
    	}
    }
}

 

 

Hmm, have you tried something like this? I did something like this ages ago and I never experienced those problems with this method.

 

@Override

    public void tickEnd(EnumSet<TickType> type, Object... tickData)

    {

        ScaledResolution scaledresolution = new ScaledResolution(

        mc.gameSettings, mc.displayWidth, mc.displayHeight);

        int width = scaledresolution.getScaledWidth();

        int height = scaledresolution.getScaledHeight();

        FontRenderer fontrenderer = mc.fontRenderer;

        mc.entityRenderer.setupOverlayRendering();

       

        // render

}

  • Author

The single line of mc.entityRenderer.setupOverlayRendering(); seems to do the trick :) However it doesn't fade/transparent itself like the rest of the Gui Elements.

 

Going to check deeper into Minecrafts GUI ingame, to see if/where the alpha render is at.

 

Thank you sooo very much for giving me a proper place to start looking :D

  • Author

I sorta figured it out a back way....

 

I placed this at the very start of my renderTick end()

 

GuiScreen guiscreen = Minecraft.getMinecraft().currentScreen;
    		if (guiscreen == null || mc.ingameGUI.getChatGUI().getChatOpen())
    		{

 

This way if any GUI is open, the custom hud will not render. However the hud still renders on top the chat window :D

 

Thanks for your help Sir!

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.