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

Hi, I can't seem to send a translated chat component to a client that has any formatting such as color or italics. I can send the translated chat message, but I can't apply a color like Aqua to it. I've tried doing things like putting the color format code directly into the lang file itself but that doesn't work. I can't find anything through google that would help me, but all that I could find that was relevant was this (http://www.minecraftforge.net/forum/index.php?topic=25566.0), but that info is either outdated or just plain doesn't work.

 

 

Relevant code:

((EntityPlayer) entity).addChatComponentMessage(new ChatComponentTranslation("event.slimerain.end"))

 

Thanks in advance!

Hi

Have you tried EnumChatFormatting? You said you needed color / italics / bold right? Look at this:

((EntityPlayer) entity).addChatComponentMessage(new ChatComponentTranslation(EnumChatFormatting.RED + "event.slimerain.end")) *May not be 100% accurate code*

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

it spits out event.slimerain.end because if you don't have a .lang file that contains (event.slimerain.end=Whatever the translation is) dont add the brackets, it wont translate it, plus for it to use what is in the lang file you add new ChatComponentTranslation(EnumChatFormatting.RED + I18n.format("event.slimerain.end");

  • Author

I know about lang files and all that, but I didn't know about I18n.format(), which seemed to solve my problem. Thanks!

  • 2 weeks later...

Hey Guys,

 

i have a problem.

 

I cant cast chatstyle to chatcomponent

 


sender.addChatMessage(new ChatComponentTranslation("commands.troll.success.sender", args[0], args[1]).getChatStyle().setColor(EnumChatFormatting.RED));
[/Code]

 

What is wrong or how to fix it?

 

P.S. my english is not the best :P German

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.