Render text on screen with MCP in Minecraft 1.18

Viewed 470

I want to display a text on the screen in Minecraft 1.18 with MCP-Reborn. I have watched tutorials on YouTube but they only cover how to do it in 1.12, after around 4 hours of searching the internet I didn't find anything for 1.18. In 1.12 they used Minecraft.getMinecraft().fontRendererObj.drawString(text, x, y, color);.

2 Answers

Yeah there is like no documentation on mcp reborn :/

But to display text you can use:

Minecraft.getInstance().font.draw(poseStack, "Your text", x, y, color);

PoseStack is only in the newer minecraft code so i previously never heard of it. If you draw the text in a gui with the render method (in previous versions called drawScreen) you can just use the passed PoseStack, else i would probably just create a new instance, works aswell.

x, y and color are the same as in 1.8 and 1.12

font is pretty much the new fontrendererobj

I hope this is helpful

The problem with MCP is that it only works for 1.7.10, 1.8.8, 1.9.4, 1.10, 1.11.2 and 1.12 as we can see in their download page. That's probably why no one covers how to do it pass those versions.

However, you could use MCP-Reborn, it might be helpful!

Related