Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.8] Tooltip formatting breaks after the mod has been built


Ferrettomato
 Share

Recommended Posts

I've been using the section sign (§) to make my item tooltips a bit more colorful. I've been doing this using Item#addInformation. The formatting works perfectly in the development environment, but whenever I build the mod and use it in the actual game, it bugs out and seems to replace all the section signs with another unintelligible symbol, resulting in no formatting taking place. What's wrong?

Link to comment
Share on other sites

You need to make Gradle compile your code as UTF-8 by adding this to build.gradle:

tasks.withType(JavaCompile) {
    options.encoding = 'UTF-8'
}

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Java doesn't like symbols, so it's best to pass the unicode index from the JVM to the system.

This is not true. Java is fine with Symbols you just have to encode stuff properly. Use UTF-8 everywhere and you will be fine. Just telling javac to use UTF-8 is not enough, you also have to tell your IDE to save files in UTF-8 (why this is not the default is beyond me).

 

Moreover: Use EnumChatFormatting.

Link to comment
Share on other sites

Like diesieben07 said, it will work if you use UTF-8 everywhere. I assumed that your code was already saved as UTF-8, I didn't realise that the section sign is also present in older encodings like Windows-1252.

 

You can see an example of this here (lang file is here). It looks like this in the obfuscated client.

 

Edit: Added missing closing tag

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.