From ae916ac62a0a75749cfc4a1974d5fb40b6dc7ddf Mon Sep 17 00:00:00 2001 From: Glease <4586901+Glease@users.noreply.github.com> Date: Thu, 5 Jan 2023 00:09:52 +0800 Subject: force compound to be grouped together in chemical formula (#1630) * force compound to be grouped together in chemical formula Signed-off-by: Glease <4586901+Glease@users.noreply.github.com> * patch up glass chemical formula Signed-off-by: Glease <4586901+Glease@users.noreply.github.com> * merge two toString Signed-off-by: Glease <4586901+Glease@users.noreply.github.com> Signed-off-by: Glease <4586901+Glease@users.noreply.github.com> --- src/main/java/gregtech/api/objects/MaterialStack.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/main/java/gregtech/api/objects') diff --git a/src/main/java/gregtech/api/objects/MaterialStack.java b/src/main/java/gregtech/api/objects/MaterialStack.java index 3e68105f0e..21fee36b17 100644 --- a/src/main/java/gregtech/api/objects/MaterialStack.java +++ b/src/main/java/gregtech/api/objects/MaterialStack.java @@ -40,17 +40,19 @@ public class MaterialStack implements Cloneable { @Override public String toString() { + return toString(false); + } + + public String toString(boolean single) { String temp1 = "", temp2 = mMaterial.getToolTip(true), temp3 = "", temp4 = ""; if (mAmount > 1) { temp4 = GT_Utility.toSubscript(mAmount); - - if (mMaterial.mMaterialList.size() > 1 || isMaterialListComplex(this)) { - temp1 = "("; - temp3 = ")"; - } } - return String.valueOf( - new StringBuilder().append(temp1).append(temp2).append(temp3).append(temp4)); + if ((!single || mAmount > 1) && isMaterialListComplex(this)) { + temp1 = "("; + temp3 = ")"; + } + return temp1 + temp2 + temp3 + temp4; } private boolean isMaterialListComplex(MaterialStack materialStack) { -- cgit