Include color cods to the send message option

Published 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

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

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.

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.



Donate to MCreator

By donating to developers you can speed up development, as with more resources, we can dedicate more time to MCreator. It is a free project made by developers working on it in their free time.