Jump to content

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


Jade_Knightblazer

Recommended Posts

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);
                }
    		}
    	}
    }
}

 

 

Link to comment
Share on other sites

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

}

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • If you're seeking an unparalleled solution to recover lost or stolen cryptocurrency, let me introduce you to GearHead Engineers Solutions. Their exceptional team of cybersecurity experts doesn't just restore your funds; they restore your peace of mind. With a blend of cutting-edge technology and unparalleled expertise, GearHead Engineers swiftly navigates the intricate web of the digital underworld to reclaim what's rightfully yours. In your moment of distress, they become your steadfast allies, guiding you through the intricate process of recovery with transparency, trustworthiness, and unwavering professionalism. Their team of seasoned web developers and cyber specialists possesses the acumen to dissect the most sophisticated schemes, leaving no stone unturned in their quest for justice. They don't just stop at recovering your assets; they go the extra mile to identify and track down the perpetrators, ensuring they face the consequences of their deceitful actions. What sets  GearHead Engineers apart is not just their technical prowess, but their unwavering commitment to their clients. From the moment you reach out to them, you're met with compassion, understanding, and a resolute determination to right the wrongs inflicted upon you. It's not just about reclaiming lost funds; it's about restoring faith in the digital landscape and empowering individuals to reclaim control over their financial futures. If you find yourself ensnared in the clutches of cybercrime, don't despair. Reach out to GearHead Engineers and let them weave their magic. With their expertise by your side, you can turn the tide against adversity and emerge stronger than ever before. In the realm of cybersecurity, GearHead Engineers reigns supreme. Don't just take my word for it—experience their unparalleled excellence for yourself. Your journey to recovery starts here.
    • Ok so this specific code freezes the game on world creation. This is what gets me so confused, i get that it might not be the best thing, but is it really so generation heavy?
    • Wizard web recovery has exhibited unparalleled strength in the realm of recovery. They stand out as the premier team to collaborate with if you encounter withdrawal difficulties from the platform where you’ve invested. Recently, I engaged with them to recover over a million dollars trapped in an investment platform I’d been involved with for months. I furnished their team with every detail of the investment, including accounts, names, and wallet addresses to which I sent the funds. This decision proved to be the best I’ve made, especially after realizing the company had scammed me.   Wizard web recovery ensures exemplary service delivery and ensures the perpetrators face justice. They employ advanced techniques to ensure you regain access to your funds. Understandably, many individuals who have fallen victim to investment scams may still regret engaging in online services again due to the trauma of being scammed. However, I implore you to take action. Seek assistance from Wizard Web Recovery today and witness their remarkable capabilities. I am grateful that I resisted their enticements, and despite the time it took me to discover Wizard web recovery, they ultimately fulfilled my primary objective. Without wizard web recovery intervention, I would have remained despondent and perplexed indefinitely.
    • I've tested the same code on three different envionrments (Desktop win10, desktop Linux and Laptop Linux) and it kinda blows up all the same. Gonna try this code and see if i can tune it
    • Minecraft version? Mod loader?
  • Topics

×
×
  • Create New...

Important Information

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