Add the ability to use raw JSON in a tab to be able to use graphics and more.
Opened this issue Β· 21 comments
Description
Hello. You are apparently the only one who has created a plugin that can display a custom font in a tab. This is very cool, and I am very grateful to you for this.
I'm creating a resource pack for my server, with which I want to display custom graphic elements in TAB, (like prefixes on the Origin Realms server). But I don't want to force my players to install my resource pack. Therefore, I want to make it so that those players who have not installed the resource pack will display normal text prefixes and vice versa - for those who have installed, "graphic" prefixes will be displayed. This can be achieved with vanilla raw JSON, which can be used in the /tellraw command for example. This is done in a combination of using a custom font and the "translate" function https://minecraft.fandom.com/wiki/Raw_JSON_text_format#Translate
It would be cool if you made it possible to use raw minecraft JSON in prefixes, header and footer. This will open up new possibilities for TAB design, for example, it will allow you to automatically translate text, allow you to use images through a resource pack, add interactivity and much more.
If you have added the ability to use a custom font, then your plugin most likely already has a base for processing JSON. So it probably shouldn't be very difficult to add this.
Here is an example of what can be done with json in combination with a resource pack, custom font and translate: https://i.imgur.com/u5pugxz.png
https://i.imgur.com/ukz2UDt.jpeg
But... Why won't JSON work in player prefixes? :( Is this not possible due to the limitations of Minecraft itself or some other reason?
It is possible, but I only worked firstly on header/footer to implement this. I will add this ability to groups too later.
Wow. Can't wait for prefixes. π€€
I like this idea.
Basically, you want to be able to specify the TranslatedText format like {"translate":"chat.type.advancement.task","with":["Replacement"]}
, so in this case the %s
selector will be the Replacement
and the result will be Replacement has made the advancement
? Or do you want to use a full JSON format?
I like this idea.
Basically, you want to be able to specify the TranslatedText format like
{"translate":"chat.type.advancement.task","with":["Replacement"]}
, so in this case the%s
selector will be theReplacement
and the result will beReplacement has made the advancement
? Or do you want to use a full JSON format?
It would be nice if full json formatting could be used.
I like this idea.
Basically, you want to be able to specify the TranslatedText format like
{"translate":"chat.type.advancement.task","with":["Replacement"]}
, so in this case the%s
selector will be theReplacement
and the result will beReplacement has made the advancement
? Or do you want to use a full JSON format?
yes, maybe that would be enough, but still, it would be even cooler if you could use full-fledged json :D
Wow! If such functionality appears in the plugin, I will definitely put it on my server!
The above commit implements this feature. You will be able to use in the next release of TL. Remember that you can only append JSON texts in header/footer. Will create a small documentation for this how to use.
The above commit implements this feature. You will be able to use in the next release of TL. Remember that you can only append JSON texts in header/footer. Will create a small documentation for this how to use.
Cheers thanks!
But... Why won't JSON work in player prefixes? :( Is this not possible due to the limitations of Minecraft itself or some other reason?
But... Why won't JSON work in player prefixes? :( Is this not possible due to the limitations of Minecraft itself or some other reason?
It is possible, but I only worked firstly on header/footer to implement this. I will add this ability to groups too later.
But... Why won't JSON work in player prefixes? :( Is this not possible due to the limitations of Minecraft itself or some other reason?
It is possible, but I only worked firstly on header/footer to implement this. I will add this ability to groups too later.
Understood thanks! Looking forward to this feature. ππ»
Thank you very much for your work!
The commit attached above includes json support for groups. Currently only tested on 1.18.2 clients, it may not work on versions below this.
If you want to test, you can install the new build from Actions tab, select the first one and look for Artifacts.
It's cool but could you provide an example of json usage in prefixes and header/footer? Because i can't make it to work.
The commit attached above includes json support for groups. Currently only tested on 1.18.2 clients, it may not work on versions below this.
If you want to test, you can install the new build from Actions tab, select the first one and look for Artifacts.
Got it, thanks! Sorry for my stupidity. Now everything is working! I did not think that the problem could be in one extra space. π
Thank you very much for your work! Finally, I can do what I have long dreamed of. With this now it will be possible to come up with a lot of interesting things.
Remove the extra space before
{
->["",{"text":"test123 ","color":"red"}]
Well, another dumb problem... I've tested different combinations of json and in some cases it works fine, in some it doesn't.
Let's take this json as an example. With my resource pack, SomeTextToReplace should change to test123. And this example works okay:
But, now let's take a more complex json example. In this case, SomeTextToReplace should also be replaced by test123 and it should be red:
But for some reason this doesn't work. As I understand it, you only added support for "basic" features for translate, which do not support text formatting, as you wrote here #341 (comment) or am I doing something wrong?
Thanks for your report, I managed to fix this problem, you can install again the newest build from Actions page.
Thanks for your report, I managed to fix this problem, you can install again the newest build from Actions page.
Thanks, now it works! But... There was a new problem... π
Let's take for example the same json as above. After your fix, it works well and the replaced text "test123" is colored in the specified color - red.
["",{"translate":"SomeTextToReplace","with":[{"text":"test123","color":"red"}]}]
But, if the required resource pack is not installed, then "SomeTextToReplace" should be displayed instead of "test123". Let's try to give this text some color, for example - green:
["",{"translate":"SomeTextToReplace","with":[{"text":"test123","color":"red"}],"color":"green"}]
And... For some reason this doesn't work.
Did you tried to move color
property before with
? ["",{"translate":"SomeTextToReplace","color":"green","with":[{"text":"test123","color":"red"}]}]