Posted December 23, 20204 yr Hello, guys! I want feedback to be colored, for example, Repaired Stick for Player001 I'm doing it right now: source.sendFeedback(new TranslationTextComponent("commands.times.night", source.getDisplayName()).func_240701_a_(TextFormatting.BLUE), true); I need Stick and Player001 to be the same color, and the rest of the message is different. Edited December 23, 20204 yr by ChA0S_f4me Mark
December 23, 20204 yr 1 hour ago, diesieben07 said: First of all, your translation keys should be prefixed with your Mod ID to avoid collisions. Then, you can use multiple place holders in the message and apply different styles to the ITextComponents you pass in as parameters to TranslationTextComponent. Then only those placeholders will be colored. You can also use IFormattableTextComponent#append to append differently styled components together. Can you set an example?
December 23, 20204 yr 12 minutes ago, diesieben07 said: new TranslationTextComponent("yourmod.foo.bar", <first component here>, <second component here>). Then have two placeholders in the translation. Thx, I'll try this
December 24, 20204 yr 8 hours ago, diesieben07 said: new TranslationTextComponent("yourmod.foo.bar", <first component here>, <second component here>). Then have two placeholders in the translation. Hmm... This is don't work source.sendFeedback(new TranslationTextComponent("commands.times.set", new TranslationTextComponent("commands.times.night", source.getDisplayName()).func_240701_a_(TextFormatting.BLUE)), true);
December 24, 20204 yr I found the answer! source.sendFeedback(new TranslationTextComponent("commands.times.set").mergeStyle(TextFormatting.BLUE).append(new TranslationTextComponent("commands.times.night").mergeStyle(TextFormatting.LIGHT_PURPLE)), true);
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.