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.

[1.11] Why is my gui texture randomly being replaced by the alphabet...?

Featured Replies

Posted

This is the weirdest problem I've ever had  when modding.

I'm trying to make a gui that renders text over a texture in the corner of the screen.

There are four parts of the texture that I'm rendering separately, since if the player doesn't have something I don't want that part to render.

It all works perfectly, except the third and fourth parts SOMEHOW are losing my texture and instead it's rendering what looks like the default Minecraft font texture at more than double resolution?


Pictures:

Spoiler

This is what it looks like:

j0w5kj.jpg

 

This is what it's SUPPOSED to look like (texture from gimp; not to scale, with added background so you can see it):

11cgojb.jpg

 

And this is the code:

	@SubscribeEvent
	public void onRenderGui(RenderGameOverlayEvent.Post event)
	{
		if (event.getType() != ElementType.EXPERIENCE)
		{
			return;
		}
		IEchoesCapability echoes = mc.thePlayer.getCapability(EchoesManager.ECHOES, null);

		if (echoes == null)
		{
			return;
		}

		this.mc.getTextureManager().bindTexture(hud);

		int y = 0;
		int y1 = 4;

		if (echoes.getEchoes() > 0) // The rune-like symbol. Works.
		{
			this.drawTexturedModalRect(1, y, 0, 0, 136, 29);
			drawString(mc.fontRendererObj, TextFormatting.WHITE + "" + echoes.getEchoes(), 16, y1, colour);

			y += 30;
			y1 += 15;
		}
		if (echoes.getInsight() > 0) // The eye symbol. Works.
		{
			this.drawTexturedModalRect(1, y, 0, 29, 136, 29);
			drawString(mc.fontRendererObj, TextFormatting.WHITE + "" + echoes.getInsight(), 16, y1, colour);

			y += 30;
			y1 += 15;
		}

		int bullets = 0;

		for (ItemStack stack : mc.thePlayer.inventory.mainInventory)
		{
			if (stack.getItem() == Registry.quickSilverBullet)
			{
				bullets += stack.func_190916_E();
			}
		}

		if (bullets > 0) // The bullet symbol. Does NOT work, renders alphabet instead.
		{
			this.drawTexturedModalRect(1, y, 0, 58, 91, 29);
			// TODO draw amount

			y += 30;
			y1 += 15;
		}

		if (echoes.getCords() > 0) // The spiral-like symbol. Does NOT work, renders alphabet instead.
		{
			this.drawTexturedModalRect(1, y, 0, 87, 91, 29);
			if (echoes.getCords() >= 3)
			{
				// TODO alternate cords icon
			}
			// TODO draw amount

			y += 30;
			y1 += 15;
		}

		if (echoes.hasAsh())
		{
			// TODO alternate bullet icon
		}
	}

 

How on earth does this happen and how do I fix it?

 

And for the record, I tried adding:

		this.mc.getTextureManager().bindTexture(hud);

pretty much anywhere before it starts displaying the alphabet to try to fix it, but the result is that what ever drawTexturedModalRect() came next just doesn't get called at all.

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.