Include color cods to the send message option

Submitted by Anonymous (not verified) on Sun, 04/14/2019 - 16:11
Upvotes: 1
Issue description

At the moment if you add the color codes in to mcreator for \u00A74 or §4, §4 becomes unviewable in game and \u00A74  becomes  \\u00A74 there for these both become unuseable for none coding users.

 

so the producer needs a way to create 

			if (entity instanceof EntityPlayer && !world.isRemote) {
				((EntityPlayer) entity).sendStatusMessage(
						new TextComponentString("\u00A74WWL\u00A7r: Just no! That's creative abus\u00A7k"), (true));
			}

Rather then 

			if (entity instanceof EntityPlayer && !world.isRemote) {
				((EntityPlayer) entity).sendStatusMessage(
						new TextComponentString("\\u00A74WWL\\u00A7r: Just no! That's creative abus\\u00A7k"), (true));
			}

 

Issue comments

Submitted by Klemen on Sun, 04/14/2019 - 18:12

We will fix this issue so MCreator will properly escape such strings.

This is also a problem in your custom code section its converting \u00A74 in to it's §4 version meaning it brakes the code as the § codes don't register in the TextComponent

Submitted by Klemen on Mon, 04/15/2019 - 18:29

This one will be tough to fix, but I will try my best.

Submitted by Nuparu00 on Mon, 04/22/2019 - 20:46

It is recommended to use TextFormatting, instead of the string codes, like this:

sender.sendMessage(new TextComponentString(TextFormatting.GREEN + "Prefab has been saved to " + TextFormatting.GREEN + file.getPath()));

 

Not sure how he would add that to the UI unless he added a little text editor so it would know how to change it to the TextFormatting maybe.

Submitted by Klemen on Tue, 04/23/2019 - 09:49

We might add text editor in the future, but for now I will try to at least fix the issue with characters not being properly escaped for the code.

Submitted by Klemen on Fri, 06/21/2019 - 16:44

This bug will be fixed in MCreator 1.9.0.