diff --git a/src/main/java/gregtech/api/enums/Materials.java b/src/main/java/gregtech/api/enums/Materials.java index 2006c191e68..16553e2d421 100644 --- a/src/main/java/gregtech/api/enums/Materials.java +++ b/src/main/java/gregtech/api/enums/Materials.java @@ -8,6 +8,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; +import java.util.IllegalFormatException; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; @@ -3230,19 +3231,27 @@ public String toString() { } public String getDefaultLocalizedNameForItem(String aFormat) { - return String.format( - aFormat.replace("%s", "%temp") - .replace("%material", "%s"), - this.mDefaultLocalName) - .replace("%temp", "%s"); + try { + return String.format( + aFormat.replace("%s", "%temp") + .replace("%material", "%s"), + this.mDefaultLocalName) + .replace("%temp", "%s"); + } catch (IllegalFormatException ignored) { + return aFormat; + } } public String getLocalizedNameForItem(String aFormat) { - return String.format( - aFormat.replace("%s", "%temp") - .replace("%material", "%s"), - this.mLocalizedName) - .replace("%temp", "%s"); + try { + return String.format( + aFormat.replace("%s", "%temp") + .replace("%material", "%s"), + this.mLocalizedName) + .replace("%temp", "%s"); + } catch (IllegalFormatException ignored) { + return aFormat; + } } public boolean hasCorrespondingFluid() {