Posted January 14, 201411 yr In v1.6.4, when I want to format a chat message across multiple lines, I just include a '\n' character in the string. In 1.7.2, this now renders as a special glyph rather than generating a new line. I've glanced over the code a bit and have yet to find a solution. Has anybody else figured this out?
January 14, 201411 yr Try out the Java String formating (do not know if it works but try it out) String.format(Arguments, Your Text); %s = Text to show. %n = next Line. here a example: String.format("%s%n%s", "Text1", "Text2"); That should Print it like this: Text1 Text2 I hope it helps,Works.
January 14, 201411 yr Author No, this produces the same results. String.format("foo%n") generates the string "foo\n" on my platform. I'm guess that they've done something that requires structuring chat messages with some kind of markup.
January 15, 201411 yr Author Looking further at the core commands (e.g. /help), it looks like each line has to be a sent as a separate call to ICommandSender.func_145747_a() (e.g. ICommandSender.sendChatToPlayer()). So, I simply wrote a line-breaking routine that my code calls to send chat messages: public static void sendMessageToPlayer(EntityPlayer player, String message) { ArrayIterator<String> lines = new ArrayIterator<String>(message.split("\n")); while (lines.hasNext()) player.func_145747_a(new ChatComponentText(lines.next())); }
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.