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. I want to render a small texture for a HUD. I currently have this for testing prupose:

	@SubscribeEvent
	public static void displayData(RenderGameOverlayEvent.Post event) {
		if(event.getType().equals(RenderGameOverlayEvent.ElementType.ALL)) {
			Minecraft mc = Minecraft.getInstance();
			MatrixStack matrixStack = event.getMatrixStack();

			mc.getTextureManager().bindTexture(new ResourceLocation("elementalcombat", "textures/icons/fire.png"));

			matrixStack.push();
			matrixStack.scale(0.1F, 0.1F, 0.1F);
			mc.ingameGUI.blit(matrixStack, 0, 0, 0, 0, 256, 256);     
	        matrixStack.pop();
			
	        mc.getTextureManager().bindTexture(AbstractGui.GUI_ICONS_LOCATION);	 
		}
	}

 

The image gets rendered, but I have few issues.
1. If I don't scale the matrixstack, the image is gigantic and takes up the full left side of the screen.
2. If I don't set the uWidth or vHeight to 256, only parts of the texture gets rendered.

This is weird, cause the sprite has the size of 7x7 px. Why is the sprite ingame so gigantic and also exceed the 7x7 size? If I change my ResourceLocation to GUI_ICONS_LOCATION and disable the scaling, the rendered sprite has the normal size, that I would expect from it.

  • Author

Ah okay. I knew, it must be something simple, that I overlooked.
Texture will be changed anyway. I just threw some stuff together, but thanks for the heads up anyway.

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.