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

Howdy y'all,

 

I'm trying to use GL scaling to render small versions of text on a custom-rendered ItemStack, however, this is not working nearly how I want it to. It's very close, however, the text is appearing behind the stack. Any idea why?

@Override
		protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
			super.drawGuiContainerForegroundLayer(mouseX, mouseY);
			
			if(tsfm.storedItem == null) {
				this.font.drawString("Empty", 52, 13, 0xffffff);
			}else {
				this.font.drawString(tsfm.storedItem.getName().getFormattedText(), 52, 13, 0xffffff);
				if(tsfm.internalStored < 10_000_000) {
					this.font.drawString("Stored: " + Formatting.GENERAL_FORMAT.format(tsfm.internalStored), 52, 25, 0xd4d4d4);
				}else {
					this.font.drawString("Stored: " + SCINOT.format(tsfm.internalStored), 52, 25, 0xd4d4d4);
				}
				
				RenderSystem.pushMatrix();
				
				RenderSystem.scalef(0.5f, 0.5f, 0.5f);
				this.itemRenderer.renderItemOverlayIntoGUI(this.font, tsfm.storedItem.getDefaultInstance(), (25)*2, (68)*2, "Hello!");
				
				RenderSystem.popMatrix();
				
			}
			
			
			
		}
		
		@Override
		protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
			super.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY);
			
			int x = (this.width - this.xSize) / 2;
			int y = (this.height - this.ySize) / 2;
			if(tsfm.storedItem != null) {
				
				
				this.itemRenderer.renderItemIntoGUI(tsfm.storedItem.getDefaultInstance(), (x+17), (y+60));
			}
			
		}

 

I have tested it, and rendering ItemOverlayIntoGUI works correctly and places on top of the item as proper when scaling is not involved.

 

EDIT: I actually got it all worked out. Thank you.

Capture.PNG

Edited by Haydenman2

...

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.