TransWikia.com

How do you use Minecraft 1.16's Hex Color Codes in a lang file for Resourcepacks?

Arqade Asked on November 30, 2020

Before reading… this has nothing to do with How do you use colored fonts in .lang files?

When minecraft 1.16 was released.. They allowed the ability to use full hex color codes to color chat and command text.

See here: https://www.reddit.com/r/Minecraft/comments/g6dxco/snapshot_20w17a_allows_hex_codes_to_be_used_as/

I dont actually know how its used in Commands or Chat..

But I want to know how to use it in a lang file for a reasource pack.

By lang file, I mean the file that contains the strings for everything in the game. Normally you can use the § formatting symbols in it. However, no one has yet to explain how its used for lang files.

Picture of a modified lang file: https://imgur.com/oFRfVHk

Im asking this question due to someone else mentioning it: https://www.reddit.com/r/mcresourcepack/comments/htydza/how_to_i_use_new_hex_color_formatting_116_to_lang/

One Answer

To answer this question i took a look at the mapped code from FabricMC so note that every reference to the code do not use mojangs official name for the functions and methods, however they are well documented.

when minecraft loads the .lang files it merely loads every string from a .lang file into memory. when minecraft need to draw text it calls the draw function in net.minecraft.client.font.TextRenderer which takes MatrixStack matrices, String text, float x, float y, int color and whereas some functions where we can traditionally change the color such as the chatbox give some leeway. most other screens have hardcoded values for these colors.

Correct answer by Lootjes on November 30, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP