Number formatting options

Published by aidanete on
Issue description

There is a bug with number variables when shown on strings, they get a floating-point even if I don't want to or they necessarily not need to do.  For example, I have a procedure that shows in the ingame chat a number, even if it doesn't have any decimals, it shows like that. Example

6, when shown on string, it shows as 6.0.

17, when shown on string it will show as 17.0.

This probably might be fixed in 2 ways:

1.- Changing how MCreator shows the numbers on chat, just like if there is no decimal, show directly the number or something like that.

2.- Check this ticket: https://mcreator.net/tracker/issue/50498

Issue comments

This is normal formatting of numbers in Java. This is not a bug but a feature request.

We will consider adding a number to string block with the number format specification option (optional digits, digits number, decimals number, ...).

If you want to remove decimals, go to the source code for the procedure:

If you created a variable for the number, do this:

double to int VARAIBLE = 0;

or:

I am a java programmer and I most often use this:

        if (world instanceof ServerLevel _level)

_level.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, new Vec3(x, y, z), Vec2.ZERO, _level, 4, "", Component.literal(""), _level.getServer(), null).withSuppressedOutput(),
("tellraw @a {\"text\":\"Day " + "" + (int)AnyNumberFormatingThingy + "\",\"color\":\"yellow\"}"));