Making overlay text center aligned?

Started by Toma400 on

Topic category: Help with modding (Java Edition)

Making overlay text center aligned?
Mon, 04/05/2021 - 20:59 (edited)

I tried to add overlay to my mod and for now everything seems great, except for one thing: I want to use it on different occasions, meaning sentences' length vary depending on situation. So I can put overlay text somewhere and get nice position of it on the screen, but the other time I use it, it's aligned too much on the left or on the right. It's because text is always left-aligned to text window, not the center.

Is there any classic "§" code for making it center aligned, or do I have to code it, or maybe is there another way?

(I'm using MCreator 2020.3 if that helps)

Edited by Toma400 on Mon, 04/05/2021 - 20:59
Okay, I didn't find a proper…
Wed, 04/07/2021 - 14:30

Okay, I didn't find a proper solution for that, but there's a solution making that possible around. You just can use spaces before text to move it further to the desired position.

It has its disadvantages, like, you need much direct work on each text and testing, but if you don't have countless different messages to show, it should not be a problem. For me at least it should be enough.