Posted April 3, 20169 yr My mod has a feature that reads a text files and displays the content in a gui. Now, I need to check if the string contains any color codes (section symbol + color). My problem is how do I turn the color code into an int so I can draw the string.
April 3, 20169 yr FontRender#drawString takes an int parameter for the color, which is a single-value representation of the RGB values. There are color charts available online, or you can search through Minecraft's code for their chat formatting color codes to find their values. http://i.imgur.com/NdrFdld.png[/img]
April 3, 20169 yr Author FontRender#drawString takes an int parameter for the color, which is a single-value representation of the RGB values. There are color charts available online, or you can search through Minecraft's code for their chat formatting color codes to find their values. I have looked at TextFormatting and I was not able to find anything like this. I tried to look at the mc GUIs that can handle colored texts (world selector, resource pack selector, etc) but I was not able to find anything that could help me.
April 3, 20169 yr I don't think there is any sort of color code -> int mapping anywhere in Minecraft. You either map them out yourself, or you ask your users to use the integer value of the color they want rather than a string code. http://i.imgur.com/NdrFdld.png[/img]
April 3, 20169 yr Author I don't think there is any sort of color code -> int mapping anywhere in Minecraft. You either map them out yourself, or you ask your users to use the integer value of the color they want rather than a string code. Well that sucks, I'll probably allow custom ints then as that allows more customization
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.