Jump to content

[1.7.2] multiple line chat question


libarclite

Recommended Posts

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?

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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

}

 

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.

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...

×   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.

Announcements



×
×
  • Create New...

Important Information

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