aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/nei
diff options
context:
space:
mode:
authorAlbi <12825442+Flanisch@users.noreply.github.com>2022-08-12 20:34:37 +0200
committerGitHub <noreply@github.com>2022-08-12 20:34:37 +0200
commitbbd40c34e104dcead78290af1394e6f5867df565 (patch)
tree43c8d507722b7ba189cf4acfb924ca584b287c6f /src/main/java/gregtech/nei
parentd815f1f0e7b267c1c7ef97fdf2c790b6c9f6a378 (diff)
downloadGT5-Unofficial-bbd40c34e104dcead78290af1394e6f5867df565.tar.gz
GT5-Unofficial-bbd40c34e104dcead78290af1394e6f5867df565.tar.bz2
GT5-Unofficial-bbd40c34e104dcead78290af1394e6f5867df565.zip
Added means of customizing GUI colors for resource packs (#1203)
* Added means of customizing GUI colors through lang file * Color values are now stored in json file instead of the lang file * Made json only load upon resource reload and ensured server compatibility Co-authored-by: Martin Robertz <dream-master@gmx.net>
Diffstat (limited to 'src/main/java/gregtech/nei')
-rw-r--r--src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java38
-rw-r--r--src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java4
2 files changed, 23 insertions, 19 deletions
diff --git a/src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java b/src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java
index 6de56a98b3..df4c61dee7 100644
--- a/src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java
+++ b/src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java
@@ -12,6 +12,7 @@ import codechicken.nei.recipe.GuiUsageRecipe;
import codechicken.nei.recipe.TemplateRecipeHandler;
import gregtech.GT_Mod;
import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.GuiColors;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.gui.GT_GUIContainer_BasicMachine;
import gregtech.api.objects.ItemData;
@@ -46,6 +47,7 @@ public class GT_NEI_AssLineHandler extends RecipeMapHandler {
* Can be referenced from cached recipes.
*/
public static int cycleTicksStatic = Math.abs((int) System.currentTimeMillis());
+ private final int textColor = GuiColors.NEIText.getColor();
static {
GuiContainerManager.addInputHandler(new GT_RectHandler());
@@ -243,66 +245,66 @@ public class GT_NEI_AssLineHandler extends RecipeMapHandler {
String[] recipeDesc = recipe.getNeiDesc();
if (recipeDesc == null) {
if (tEUt != 0) {
- drawText(10, 73, trans("152","Total: ") + GT_Utility.formatNumbers((long) tDuration * tEUt) + " EU", 0xFF000000);
- drawText(10, 83, trans("153","Usage: ") + GT_Utility.formatNumbers(tEUt) + " EU/t", 0xFF000000);
+ drawText(10, 73, trans("152","Total: ") + GT_Utility.formatNumbers((long) tDuration * tEUt) + " EU", textColor);
+ drawText(10, 83, trans("153","Usage: ") + GT_Utility.formatNumbers(tEUt) + " EU/t", textColor);
if (this.mRecipeMap.mShowVoltageAmperageInNEI) {
int voltage = tEUt / this.mRecipeMap.mAmperage;
byte tier = GT_Utility.getTier(voltage);
if (tier < 0 || tier >= 16) {
- drawText(10, 93, trans("154", "Voltage: ") + GT_Utility.formatNumbers(voltage) + " EU", 0xFFFF0000);
+ drawText(10, 93, trans("154", "Voltage: ") + GT_Utility.formatNumbers(voltage) + " EU", textColor);
} else {
- drawText(10, 93, trans("154","Voltage: ") + GT_Utility.formatNumbers(voltage) + " EU (" + GT_Values.VN[tier] + ")", 0xFF000000);
+ drawText(10, 93, trans("154","Voltage: ") + GT_Utility.formatNumbers(voltage) + " EU (" + GT_Values.VN[tier] + ")", textColor);
}
- drawText(10, 103, trans("155","Amperage: ") + GT_Utility.formatNumbers(this.mRecipeMap.mAmperage), 0xFF000000);
+ drawText(10, 103, trans("155","Amperage: ") + GT_Utility.formatNumbers(this.mRecipeMap.mAmperage), textColor);
} else {
- drawText(10, 93, trans("156","Voltage: unspecified"), 0xFF000000);
- drawText(10, 103, trans("157","Amperage: unspecified"), 0xFF000000);
+ drawText(10, 93, trans("156","Voltage: unspecified"), textColor);
+ drawText(10, 103, trans("157","Amperage: unspecified"), textColor);
}
}
if (tDuration > 0) {
- drawText(10, 113, trans("158","Time: ") + GT_Utility.formatNumbers(0.05d * tDuration) + trans("161"," secs"), 0xFF000000);
+ drawText(10, 113, trans("158","Time: ") + GT_Utility.formatNumbers(0.05d * tDuration) + trans("161"," secs"), textColor);
}
int tSpecial = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue;
boolean specialDrew = false;
if (tSpecial == -100 && GT_Mod.gregtechproxy.mLowGravProcessing) {
- drawText(10, 123, trans("159","Needs Low Gravity"), 0xFF000000);
+ drawText(10, 123, trans("159","Needs Low Gravity"), textColor);
specialDrew = true;
} else if (tSpecial == -200 && GT_Mod.gregtechproxy.mEnableCleanroom) {
- drawText(10, 123, trans("160","Needs Cleanroom"), 0xFF000000);
+ drawText(10, 123, trans("160","Needs Cleanroom"), textColor);
specialDrew = true;
} else if (tSpecial == -201) {
- drawText(10, 123, trans("206","Scan for Assembly Line"), 0xFF000000);
+ drawText(10, 123, trans("206","Scan for Assembly Line"), textColor);
specialDrew = true;
} else if ((GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePre)) || (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost))) {
- drawText(10, 123, this.mRecipeMap.mNEISpecialValuePre + GT_Utility.formatNumbers(tSpecial * this.mRecipeMap.mNEISpecialValueMultiplier) + this.mRecipeMap.mNEISpecialValuePost, 0xFF000000);
+ drawText(10, 123, this.mRecipeMap.mNEISpecialValuePre + GT_Utility.formatNumbers(tSpecial * this.mRecipeMap.mNEISpecialValueMultiplier) + this.mRecipeMap.mNEISpecialValuePost, textColor);
specialDrew = true;
}
int y = 123 + (specialDrew ? 10 : 0);
if (GT_Mod.gregtechproxy.mNEIRecipeOwner) {
if (recipe.owners.size() > 1) {
- drawText(10, y, EnumChatFormatting.ITALIC + GT_Utility.trans("226", "Original Recipe by: ") + recipe.owners.get(0).getName(), 0xFF000000);
+ drawText(10, y, EnumChatFormatting.ITALIC + GT_Utility.trans("226", "Original Recipe by: ") + recipe.owners.get(0).getName(), textColor);
y += 10;
for (int i = 1; i < recipe.owners.size(); i++) {
- drawText(10, y, EnumChatFormatting.ITALIC + GT_Utility.trans("227", "Modified by: ") + recipe.owners.get(i).getName(), 0xFF000000);
+ drawText(10, y, EnumChatFormatting.ITALIC + GT_Utility.trans("227", "Modified by: ") + recipe.owners.get(i).getName(), textColor);
y += 10;
}
} else if (recipe.owners.size() > 0) {
- drawText(10, y, EnumChatFormatting.ITALIC + GT_Utility.trans("225", "Recipe by: ") + recipe.owners.get(0).getName(), 0xFF000000);
+ drawText(10, y, EnumChatFormatting.ITALIC + GT_Utility.trans("225", "Recipe by: ") + recipe.owners.get(0).getName(), textColor);
y += 10;
}
}
if (GT_Mod.gregtechproxy.mNEIRecipeOwnerStackTrace && recipe.stackTraces != null && !recipe.stackTraces.isEmpty()) {
- drawText(10, y, "stackTrace:", 0xFF000000);
+ drawText(10, y, "stackTrace:", textColor);
y += 10;
for (StackTraceElement stackTrace : recipe.stackTraces.get(0)) {
- drawText(10, y, stackTrace.toString(), 0xFF000000);
+ drawText(10, y, stackTrace.toString(), textColor);
y += 10;
}
}
} else {
int i = 0;
for (String descLine : recipeDesc) {
- drawText(10, 73 + 10 * i, descLine, 0xFF000000);
+ drawText(10, 73 + 10 * i, descLine, textColor);
i++;
}
}
diff --git a/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java b/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java
index c3566d42b9..ddeba9ca91 100644
--- a/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java
+++ b/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java
@@ -15,6 +15,7 @@ import codechicken.nei.recipe.RecipeCatalysts;
import codechicken.nei.recipe.TemplateRecipeHandler;
import gregtech.GT_Mod;
import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.GuiColors;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.gui.GT_GUIContainer;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
@@ -66,6 +67,7 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
private String mRecipeName; // Name of the handler displayed on top
private NEIHandlerAbsoluteTooltip mRecipeNameTooltip;
private static final int RECIPE_NAME_WIDTH = 140;
+ private final int textColor = GuiColors.NEIText.getColor();
/**
* Static version of {@link TemplateRecipeHandler#cycleticks}.
@@ -520,7 +522,7 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler {
}
protected void drawLine(int lineNumber, String line) {
- drawText(10, getDescriptionYOffset() + lineNumber * 10, line, 0xFF000000);
+ drawText(10, getDescriptionYOffset() + lineNumber * 10, line, textColor);
}
protected int getDescriptionYOffset() {