February 14, 20179 yr So, I've been trying to figure this out for the past few hours, but the documentation is extremely sparse and I haven't been able to figure this out. I want to write some text to the screen, kind of like an FPS meter. Unfortunately for me, my mod currently doesn't display anything at all. There aren't any errors, and from what I have been able to find, the way I'm going about this is correct. I'm using Minecraft 1.11.2. Here's the code in question: import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @Mod.EventBusSubscriber public class MessageGui extends Gui { private static String text = "Test Text"; private static int color = 0xFFFFFF; private FontRenderer fontRenderer; private void verifyRenderer() { if (fontRenderer != null) return; Minecraft minecraft = Minecraft.getMinecraft(); fontRenderer = minecraft.fontRendererObj; } @SubscribeEvent public void render(RenderGameOverlayEvent.Post event) { verifyRenderer(); fontRenderer.drawStringWithShadow(text, 10, 20, color); } } As far as I've been told, @Mod.EventBusSubscriber and @SubscribeEvent should automatically subscribe the RenderGameOverlayEvent to the correct bus... but it's not doing anything at all. Can someone tell me what I'm missing here? EDIT: I AM creating an instance of this class in my mod's init() function. There shouldn't be a reason for this not to work. Edited February 14, 20179 yr by SirLollington
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.