Skip to content

Commit e59884d

Browse files
committed
Use CompoundKeys instead of String.format to avoid having to translate Lang Keys on the server and add commas to long numbers in the rate
1 parent 757260a commit e59884d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/main/java/gregtech/api/metatileentity/multiblock/ui/MultiblockUIFactory.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ public Builder addItemOutputLine(@NotNull List<ItemStack> itemOutputs, int recip
884884
IKey itemName = KeyUtil.string(TextFormatting.AQUA, entry.getKey());
885885
IKey itemAmount = KeyUtil.number(TextFormatting.GOLD, entry.getValue());
886886
IKey itemRate = KeyUtil.string(TextFormatting.WHITE, formatRecipeRate(recipeLength, entry.getValue()));
887-
addKey(KeyUtil.string(TextFormatting.WHITE, "%s x %s (%s)", itemName, itemAmount, itemRate));
887+
addKey(IKey.comp(itemName, KeyUtil.string(TextFormatting.WHITE, " x "), itemAmount, IKey.str(" "), itemRate));
888888
}
889889

890890
return this;
@@ -911,7 +911,7 @@ public Builder addFluidOutputLine(@NotNull List<FluidStack> fluidOutputs, int re
911911
IKey fluidName = KeyUtil.fluid(TextFormatting.AQUA, entry.getKey());
912912
IKey fluidAmount = KeyUtil.number(TextFormatting.GOLD, entry.getValue());
913913
IKey fluidRate = KeyUtil.string(TextFormatting.WHITE, formatRecipeRate(recipeLength, entry.getValue()));
914-
addKey(KeyUtil.string(TextFormatting.WHITE, "%s x %s (%s)", fluidName, fluidAmount, fluidRate));
914+
addKey(IKey.comp(fluidName, KeyUtil.string(TextFormatting.WHITE, " x "), fluidAmount, IKey.str(" "), fluidRate));
915915
}
916916

917917
return this;
@@ -922,9 +922,9 @@ private static String formatRecipeRate(int recipeLength, long amount) {
922922

923923
String rate;
924924
if (perSecond > 1) {
925-
rate = String.format("%.2f", perSecond).replaceAll("\\.?0+$", "") + "/s";
925+
rate = "(" + String.format("%,.2f", perSecond).replaceAll("\\.?0+$", "") + "/s)";
926926
} else {
927-
rate = String.format("%.2f", 1 / (perSecond)).replaceAll("\\.?0+$", "") + "s/ea";
927+
rate = "(" + String.format("%,.2f", 1 / (perSecond)).replaceAll("\\.?0+$", "") + "s/ea)";
928928
}
929929

930930
return rate;

0 commit comments

Comments
 (0)