Use Magic Digits in Data Packs
masterFor data pack creators, Magic Digits allow for simple scoreboard math to display dynamic widths. These digits are reskinned into space characters.
Requirements:
- Requires Minecraft 1.16+ for multi-font support.
- You must set the font to
"font":"space:default"because these digits replace ordinary numbers.
| Char | Width |
|---|---|
9 | 1 |
8 | 3 |
7 | 8 |
6 | 21 |
5 | 55 |
4 | 144 |
3 | 377 |
2 | 987 |
1 | 2584 |
- | -6765 |
Example JSON:
[
{"text": "Start", "color": "blue"},
{"font": "space:default", "score": {"name": "spacer", "objective": "spacefont"}},
{"text": "End (moved by a dynamic amount)", "color": "red"}
]Helper Data Pack:
If you load this as a data pack, you can use the function spacefont:magic_digits to convert a width between -6764 and 6764 into a set of magic digits.
[
{"text": "Start", "color": "blue"},
{"font": "space:default", "score": {"name": "spacer", "objective": "spacefont"}},
{"text": "End (moved by a dynamic amount)", "color": "red"}
]