aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/gregtech/api/util/ColorsMetadataSection.java8
-rw-r--r--src/main/java/gregtech/api/util/ColorsMetadataSectionSerializer.java20
-rw-r--r--src/main/java/gregtech/nei/RecipeMapHandler.java3
3 files changed, 15 insertions, 16 deletions
diff --git a/src/main/java/gregtech/api/util/ColorsMetadataSection.java b/src/main/java/gregtech/api/util/ColorsMetadataSection.java
index 9f1c4f3ffe..c7ec2c8aa3 100644
--- a/src/main/java/gregtech/api/util/ColorsMetadataSection.java
+++ b/src/main/java/gregtech/api/util/ColorsMetadataSection.java
@@ -42,15 +42,15 @@ public class ColorsMetadataSection implements IMetadataSection {
}
public int getTextColorOrDefault(String key, int defaultColor) {
- return sColorInMap(key, this.hexTextColors) ? defaultColor : this.textColors.get(key);
+ return isColorInMap(key, this.hexTextColors) ? this.textColors.get(key) : defaultColor;
}
public int getGuiTintOrDefault(String key, int defaultColor) {
- return sColorInMap(key, this.hexGuiTints) ? defaultColor : this.guiTints.get(key);
+ return isColorInMap(key, this.hexGuiTints) ? this.guiTints.get(key) : defaultColor;
}
- private boolean sColorInMap(String key, Map<String, String> hexMap) {
- return hexMap.containsKey(key) && hexMap.get(key).isEmpty();
+ private boolean isColorInMap(String key, Map<String, String> hexMap) {
+ return hexMap.containsKey(key) && !hexMap.get(key).isEmpty();
}
public boolean sGuiTintingEnabled() {
diff --git a/src/main/java/gregtech/api/util/ColorsMetadataSectionSerializer.java b/src/main/java/gregtech/api/util/ColorsMetadataSectionSerializer.java
index 718ff81854..b58c00db88 100644
--- a/src/main/java/gregtech/api/util/ColorsMetadataSectionSerializer.java
+++ b/src/main/java/gregtech/api/util/ColorsMetadataSectionSerializer.java
@@ -7,6 +7,7 @@ import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Dyes;
import java.lang.reflect.Type;
@@ -21,21 +22,18 @@ public class ColorsMetadataSectionSerializer extends BaseMetadataSectionSerializ
JsonElement metadataColors, Type type, JsonDeserializationContext context) {
// Default values
boolean enableGuiTint = GregTech_API.sColoredGUI;
- Map<String, String> hexGuiTintMap = new HashMap<String, String>();
- Map<String, String> hexTextColorMap = new HashMap<String, String>() {
- {
- put("title", "");
- put("text", "");
- put("value", "");
- put("nei", "");
- }
- };
+ Map<String, String> hexGuiTintMap = new HashMap<>();
+ Map<String, String> hexTextColorMap = new HashMap<>();
JsonObject jsonObject = JsonUtils.getJsonElementAsJsonObject(metadataColors, "metadata section");
if (jsonObject.has("textColor")) {
JsonObject textColors = JsonUtils.func_152754_s(jsonObject, "textColor");
- for (String key : hexTextColorMap.keySet()) {
- hexTextColorMap.replace(key, JsonUtils.getJsonObjectStringFieldValueOrDefault(textColors, key, ""));
+ for (Map.Entry<String, JsonElement> entry : textColors.entrySet()) {
+ if (entry.getValue().isJsonPrimitive()) {
+ hexTextColorMap.put(entry.getKey(), entry.getValue().getAsString());
+ } else {
+ GT_Mod.GT_FML_LOGGER.warn("ColorOverride expects primitive value for key `textColor`");
+ }
}
}
diff --git a/src/main/java/gregtech/nei/RecipeMapHandler.java b/src/main/java/gregtech/nei/RecipeMapHandler.java
index 5449484471..81caaffee7 100644
--- a/src/main/java/gregtech/nei/RecipeMapHandler.java
+++ b/src/main/java/gregtech/nei/RecipeMapHandler.java
@@ -1,6 +1,7 @@
package gregtech.nei;
import codechicken.nei.recipe.TemplateRecipeHandler;
+import com.gtnewhorizons.modularui.api.ModularUITextures;
import gregtech.api.gui.GT_GUIColorOverride;
import gregtech.api.util.GT_Recipe;
import net.minecraft.client.Minecraft;
@@ -17,7 +18,7 @@ abstract class RecipeMapHandler extends TemplateRecipeHandler {
RecipeMapHandler(GT_Recipe.GT_Recipe_Map mRecipeMap) {
this.mRecipeMap = mRecipeMap;
- colorOverride = GT_GUIColorOverride.get(mRecipeMap.mNEIGUIPath);
+ colorOverride = GT_GUIColorOverride.get(ModularUITextures.VANILLA_BACKGROUND.location);
}
GT_Recipe.GT_Recipe_Map getRecipeMap() {