Posted July 21, 201510 yr 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!
July 21, 201510 yr 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]
July 21, 201510 yr Author When I try that, it just spits out event.slimerain.end, but in red/italics/whatever.
July 21, 201510 yr 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");
July 21, 201510 yr Author I know about lang files and all that, but I didn't know about I18n.format(), which seemed to solve my problem. Thanks!
August 3, 201510 yr 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 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.