Posted January 11, 201411 yr The problem is the following: I've created a code to display a chat message with a red color: EnumChatFormatting.RED + ModInfo[0] + " (" + ModInfo[1] + ") is out of date! Please visit " + ModInfo[3] + " to get the latest version (" + ModInfo[2] +")"; But when i run minecraft i don't get the full message on red, only the first line: https://dl.dropboxusercontent.com/u/184200482/img/chat_version_message.png[/img] Does anybody know why does it happens and how to solve it? Thanks for helping.
January 12, 201411 yr What do you want the end result to be? When using EnumChatFormatting, whatever format you put will apply to the entire string unless you call EnumChatFormatting.RESET. For example, if you do par1EntityPlayer.addChatMessage(EnumChatFormatting.RED + "Red" + EnumChatFormatting.RESET + " White"); The Red will be colored red, and the white will be colored default. Also, is that a clickable link?
January 12, 201411 yr What do you want the end result to be? When using EnumChatFormatting, whatever format you put will apply to the entire string unless you call EnumChatFormatting.RESET. His problem is that it isn't effecting the whole string, it's only effecting until a new-line. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
January 12, 201411 yr What do you want the end result to be? When using EnumChatFormatting, whatever format you put will apply to the entire string unless you call EnumChatFormatting.RESET. His problem is that it isn't effecting the whole string, it's only effecting until a new-line. *affecting, sorry, can't help it I don't see why it wouldn't carry over from line to line. In fact, it shouldn't, so your problem is in the link. Also, I asked if it was a clickable link because I'm fairly confident the link would reset the chat formatting, so if you put EnumChatFormatting.RED after your link it should show everything but the link in red.
January 12, 201411 yr Author What do you want the end result to be? When using EnumChatFormatting, whatever format you put will apply to the entire string unless you call EnumChatFormatting.RESET. For example, if you do par1EntityPlayer.addChatMessage(EnumChatFormatting.RED + "Red" + EnumChatFormatting.RESET + " White"); The Red will be colored red, and the white will be colored default. Also, is that a clickable link? What do you want the end result to be? When using EnumChatFormatting, whatever format you put will apply to the entire string unless you call EnumChatFormatting.RESET. His problem is that it isn't effecting the whole string, it's only effecting until a new-line. *affecting, sorry, can't help it I don't see why it wouldn't carry over from line to line. In fact, it shouldn't, so your problem is in the link. Also, I asked if it was a clickable link because I'm fairly confident the link would reset the chat formatting, so if you put EnumChatFormatting.RED after your link it should show everything but the link in red. No that is not a clickable link (I don't know how to do it)
January 12, 201411 yr Author What do you want the end result to be? When using EnumChatFormatting, whatever format you put will apply to the entire string unless you call EnumChatFormatting.RESET. His problem is that it isn't effecting the whole string, it's only effecting until a new-line. yes, it's the problem I have. Do you know how to solve it?
January 12, 201411 yr yes, it's the problem I have. Do you know how to solve it? No. I haven't messed with chat formatting in chat strings, only addInformation() which doesn't support newlines. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
January 12, 201411 yr Have you tried adding the method a few more times to reset it? Try this for example: EnumChatFormatting.RED + ModInfo[0] + " (" + ModInfo[1] + ") is out of date! Please visit " + EnumChatFormatting.RED + ModInfo[3] + " to get the " + EnumChatFormatting.RED + "latest version (" + ModInfo[2] +")"; I don't know if it would work, because I have never had this issue before... worth a try
January 12, 201411 yr Author Have you tried adding the method a few more times to reset it? Try this for example: EnumChatFormatting.RED + ModInfo[0] + " (" + ModInfo[1] + ") is out of date! Please visit " + EnumChatFormatting.RED + ModInfo[3] + " to get the " + EnumChatFormatting.RED + "latest version (" + ModInfo[2] +")"; I don't know if it would work, because I have never had this issue before... worth a try Yes, i already thought about that, and it works: https://dl.dropboxusercontent.com/u/184200482/img/chat_version_message_1.png[/img] BUT, if i reduce the chat width: https://dl.dropboxusercontent.com/u/184200482/img/chat_version_message_2.png[/img] THEN, happens this: https://dl.dropboxusercontent.com/u/184200482/img/chat_version_message_3.png[/img] So, it's not solved at all.
January 13, 201411 yr I wonder if its a problem with 1.7.2's EnumChatFormatting (1.6.2 EnumChatFormatting works for me [tested too]) Have you tried using your own String Formatter? Here try this for example: public class StringHandler { public static String dark_black = "\u00a70"; public static String dark_blue = "\u00a71"; public static String dark_green = "\u00a72"; public static String dark_cyan = "\u00a73"; public static String dark_red = "\u00a74"; public static String dark_purple = "\u00a75"; public static String dark_yellow = "\u00a76"; public static String gray = "\u00a77"; public static String dark_gray = "\u00a78"; public static String blue = "\u00a79"; public static String green = "\u00a7A"; public static String cyan = "\u00a7B"; public static String red = "\u00a7C"; public static String purple = "\u00a7D"; public static String yellow = "\u00a7E"; public static String white = "\u00a7F"; } Now, to use it: StringHandler.red + ModInfo[0] + " (" + ModInfo[1] + ") is out of date! Please visit " + ModInfo[3] + " to get the latest version (" + ModInfo[2] +")"; Good luck
January 14, 201411 yr Author I wonder if its a problem with 1.7.2's EnumChatFormatting (1.6.2 EnumChatFormatting works for me [tested too]) Have you tried using your own String Formatter? Here try this for example: public class StringHandler { public static String dark_black = "\u00a70"; public static String dark_blue = "\u00a71"; public static String dark_green = "\u00a72"; public static String dark_cyan = "\u00a73"; public static String dark_red = "\u00a74"; public static String dark_purple = "\u00a75"; public static String dark_yellow = "\u00a76"; public static String gray = "\u00a77"; public static String dark_gray = "\u00a78"; public static String blue = "\u00a79"; public static String green = "\u00a7A"; public static String cyan = "\u00a7B"; public static String red = "\u00a7C"; public static String purple = "\u00a7D"; public static String yellow = "\u00a7E"; public static String white = "\u00a7F"; } Now, to use it: StringHandler.red + ModInfo[0] + " (" + ModInfo[1] + ") is out of date! Please visit " + ModInfo[3] + " to get the latest version (" + ModInfo[2] +")"; Good luck No, i haven't. It don't works :'( :'(
September 8, 201411 yr I know this is a bit out of date, but in case anyone else wonders across this, I had to address this issue when adding a /reply command to private messages. While it may be a bit overkill, perhaps you could parse outgoing text through a custom method and split it at any spaces, and add your desired formatting before each word. In my scenario I had to iterate through the String[] 'parameters' and manually add spaces, so I also added the chat formatting, which fully addressed the issue. It generically could look something like this: String s = ""; String[] m = message.split(" "); for(String t : m){ s += formatString; s += t; s += " "; } ...where message = the original message and formatString = the desired formatting and s = your new, completed message. It feels overkill, but it works! Hope that helps. I'll need help, and I'll give help. Just ask, you know I will!
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.