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

Hello.

So I have a GuiScreen that isn't displaying textures it loaded and I am at a loss of ideas.

 

This is my render function in my gui.

@Override
public void render(int mouseX, int mouseY, float partialTicks) {
	List<Spell> spells = this.isg.getSpells();
		
	if(spells.size() > 0) {
		double angle = (2 * Math.PI) / (spells.size());
		double range = 90;
			
		for(int i = 0; i < spells.size(); i++) {
			int x = (int) (range * Math.sin(angle * i));
			int y = (int) (-range * Math.cos(angle * i));
				
			GlStateManager.color3f(1.0F, 1.0F, 1.0F);
			this.mc.getTextureManager().bindTexture(spells.get(i).getSpellTexture());
			SoulMagic.LOGGER.info("hello");
			this.drawTexturedModalRect((this.width / 2) + x - 16, (this.height / 2) + y - 16, 0, 0, 32, 32);
		}
	}
	super.render(mouseX, mouseY, partialTicks);
}

 

I know for a fact that my x and y positions are correct and my textures are being loaded, as it showed a broken texture in the right positions when the texture weren't being loaded properly. With the logger.info it spams "hello" in the console, so it is being called.

I'm not good with GUIs so I don't know if "render" is the best place for it. I only know the draw foreground/background methods from GuiContainer. I grabbed that GlStateManager statement from somewhere, it was originally .color4f but that doesn't work either.

 

The textures is 32x32 and I want to render the whole thing. I am on Forge Version 1.13.2-25.0.215, the latest version of forge for 1.13.2.

Edited by RainbowLuigi281

drawTexturedModalRect assumes that the size of your texture is 256x256, so you are drawing a rect with the texture coordinates from 0, 0 to 8, 8 px.

You would need to either hve a custom implementation or use one of the overloads that allows you to specify the UVs directly.

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.