Project Expansion

Project Expansion

4M Downloads

Unformatted number for "not enough EMC" message when extracting from an EMC Link

James103 opened this issue ยท 1 comments

commented

As of Project Expansion 1.0.9 for Minecraft 1.18.2, when attempting to extract items from an EMC Link but without having enough EMC to extract the item, the message "You do not have enough emc to purchase this; you need %s" is displayed, where %s is the EMC value of the item.

However, this value is displayed raw, with no formatting whatsoever.
Example when extracting an item worth 1.23 Million EMC: "You do not have enough emc to purchase this; you need 1234567"
Corrected: "You do not have enough emc to purchase this; you need 1.23 Million"

This is because there are still some instances where String.valueOf is used to format a (large) EMC value, where EMCFormat.format should be used.

Example:

player.displayClientMessage(new TranslatableComponent("item.projectexpansion.matter_upgrader.not_enough_emc", EMCFormat.format(BigInteger.valueOf(diff))).setStyle(ColorStyle.RED), true);

Non-example:

player.displayClientMessage(new TranslatableComponent("block.projectexpansion.emc_link.not_enough_emc", new TextComponent(String.valueOf(BigInteger.valueOf(ProjectEAPI.getEMCProxy().getValue(itemStack)))).setStyle(ColorStyle.GREEN)).setStyle(ColorStyle.RED), true);

commented

Fixed in latest releases
1.14: 1.0.10
1.15: 1.0.29
1.16: 1.0.30
1.18: 1.0.10