Jump to content

[1.7.10] Colored Chat Translation


Recommended Posts

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!

Link to comment
Share on other sites


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]

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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


What is wrong or how to fix it?


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

Link to comment
Share on other sites

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.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

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