Fabric API

Fabric API

106M Downloads

Rendering text to HUD

sh0rez opened this issue ยท 1 comments

commented

Hello all, I am new to Fabric.

I am trying to render to the ingame HUD, in the upper left corner. I did try this in my onInitialize:

ClientTickCallback.EVENT.register((client) -> {
  if (client.player == null) {
    return;
  }

  client.textRenderer.draw("hello", 10, 10, 16777215);
});

Unfortunately, this does not do anything at all. Do I miss something?

This exact method worked some time ago using ModCoderPack, with Minecraft.getMinecraft().fontRenderer.draw()

commented

Okay, I did solve this with some advice on Discord using HudRenderCallback(). Putting above code in there does the trick