Posted September 27, 201411 yr 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 ) help would be greatly appreciated!
September 27, 201411 yr 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
September 27, 201411 yr 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!
September 27, 201411 yr 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
September 27, 201411 yr 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!
September 28, 201411 yr 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.