Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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 by ChA0S_f4me
Mark

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?

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

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);

1079064631_.png.9c4027ee8d77e758c2f892d2f3e46b29.png

 

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);

1644692042_-.png.ca8df13a106dd7a47fe82dfacdd54b29.png

 

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.