Ferrettomato Posted September 23, 2015 Posted September 23, 2015 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? Quote
Choonster Posted September 23, 2015 Posted September 23, 2015 You need to make Gradle compile your code as UTF-8 by adding this to build.gradle: tasks.withType(JavaCompile) { options.encoding = 'UTF-8' } Quote 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.
Ferrettomato Posted September 23, 2015 Author Posted September 23, 2015 I added that to the end of the file (since you didn't specify a location), but it's just replaced the unintelligible character with a '?' in a white square. Quote
TrashCaster Posted September 23, 2015 Posted September 23, 2015 Type '\u00a7' instead of the section sign. Java doesn't like symbols, so it's best to pass the unicode index from the JVM to the system. Quote
Choonster Posted September 23, 2015 Posted September 23, 2015 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 Quote 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.
Recommended Posts
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.