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

I'm probably missing something really obvious here, but I can't get a string to render on the screen. My aim is to get an update-every-tick meter of an NBT integer that only shows when you are wearing a certain helmet, but even just rendering the word "works" doesn't do anything.

 

FML (Tick) Event Handler

public class FMLEventHandler {

private Minecraft mc = Minecraft.getMinecraft();
private ScaledResolution sclRes;

public FMLEventHandler() {
	sclRes = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
}

@SubscribeEvent
public void render(RenderGameOverlayEvent event)
{
	mc.fontRenderer.drawString("works", sclRes.getScaledWidth()/2, sclRes.getScaledHeight()/2, 0xffffffff, false);
}
}

 

I've registered the handler like so:

FMLCommonHandler.instance().bus().register(new FMLEventHandler());

 

Any (working :D) help would be greatly appreciated!

I'm almost 100% sure RenderGameOverlayEvent is a forge event, so register it in MinecraftForge.EVENT_BUS. Don't forget to register it on the client side ONLY!

Kain

Why don't you just make a gui screen that is not modal, etc, and draw it there? Maybe there's something I don't know about guis but wouldn't that work?

I'll need help, and I'll give help. Just ask, you know I will!

Gui disable movement if you actually open the gui I believe, which is something you don't want to do when rendering a HUD.

Kain

screen that is not modal

 

That's what "modal" means - the screen is on top and must be dismissed before play continues - and although I haven't done it myself and there are others here who would know more specifically... what about the HUD? It is a screen GUI I believe and game operates normally with it up.

 

 

edit: if nothing else, this is where I would look to find your answer. Do what the HUD does.

I'll need help, and I'll give help. Just ask, you know I will!

  • Author

I'm almost 100% sure RenderGameOverlayEvent is a forge event, so register it in MinecraftForge.EVENT_BUS. Don't forget to register it on the client side ONLY!

 

THANK YOU SO MUCH!!! I think I got it confused with the RenderTickEvent (on the FML bus) and it's not on the Forge Bus Event List so I put it on the FML bus. Also would this count as registering client side only?

@SideOnly(Side.CLIENT)
@SubscribeEvent
public void render(RenderGameOverlayEvent event)
{
	if (event.type == ElementType.TEXT) {
		mc.fontRenderer.drawString("works", 2, 2, 0xFFFFFFFF, false);
	}
}

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.