Skip to content

Instantly share code, notes, and snippets.

Created February 13, 2014 20:10
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save anonymous/8982863 to your computer and use it in GitHub Desktop.
Minecraft Forge 1.7.2 text drawing not working
// TickEventHandler.java
class TickEventHandler {
@SubscribeEvent
public void onClientTickEvent(ClientTickEvent event) {
if (TickEvent.Phase.END != event.phase && TickEvent.Type.RENDER != event.type) {
return;
}
// setup render
Minecraft mc = Minecraft.getMinecraft();
ScaledResolution res = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
FontRenderer fontRender = mc.fontRenderer;
int width = res.getScaledWidth();
int height = res.getScaledHeight();
mc.entityRenderer.setupOverlayRendering();
// draw
String text = "Hello World";
int x = 100;
int y = 200;
int color = 0xFFFFFF;
fontRender.drawStringWithShadow(text, x, y, color);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment