Closed willemml closed 3 years ago
This isn't an issue with 1.16, it doesn't work because the library doesn't support translate
components, as I didn't want to package a bunch of localization files with it. However, now that I think about it, it could very well be doable. I'll see about putting something together.
You can now pass a TranslationSource
to the constructor for JsonTextParser
or AutoMCFormatParser
(renamed from MCFormatParser
) to provide translation keys.
Example (using your JSON string as reference): https://github.com/PorkStudios/PorkLib/blob/30040e5f67382d2a697eceff608eb6f309b953fd/minecraft/minecraft-text/src/example/java/FormattedPrintExample.java#L62 Result:
Once Jenkins finishes compiling 30040e5f67382d2a697eceff608eb6f309b953fd, you can use it by refreshing your Maven/Gradle project (you may have to force update dependencies if your local repo cache is acting up)
This is awesome, I just tried it out, works great! Thanks a lot!
The minecraft-text library does not seem to parse chat messages in my "unmodded" (no plugins) Purpur (a Paper/Spigot/CraftBukkit fork), this may be due to the strange format it uses (note that everything useful is inside of "with"):
This is the Json given by the
getOriginal()
method, howevertoRawString()
andgetText()
do not include the message ("hello"), they are empty/blank strings. However parsing works fine when I use the same server jar on a server using my custom chat plugin/mod which gives the following json:and gives the correct message "
<notfunnydidntask> hello
".Same thing occurs with with /tell or /say messages, they work on the "modded" server but not on the "unmodded" server.
The code can be seen here.