diff options
Diffstat (limited to 'src')
54 files changed, 392 insertions, 391 deletions
diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java index 69f9447998..f59c7c18df 100644 --- a/src/main/java/gregtech/GT_Mod.java +++ b/src/main/java/gregtech/GT_Mod.java @@ -64,7 +64,6 @@ import gregtech.loaders.load.GT_SonictronLoader; import gregtech.loaders.misc.GT_Achievements; import gregtech.loaders.misc.GT_Bees; import gregtech.loaders.misc.GT_CoverLoader; -import gregtech.loaders.misc.GT_JsonLoader; import gregtech.loaders.postload.*; import gregtech.loaders.preload.*; import gregtech.nei.IMCForNEI; @@ -157,9 +156,6 @@ public class GT_Mod implements IGT_Mod { public static final String aTextIC2 = "ic2_"; public static final Logger GT_FML_LOGGER = LogManager.getLogger("GregTech GTNH"); - @SideOnly(Side.CLIENT) - public static GT_JsonLoader jsonGuiColors; - static { if ((509 != GregTech_API.VERSION) || (509 != GT_ModHandler.VERSION) || (509 != GT_OreDictUnificator.VERSION) || (509 != GT_Recipe.VERSION) || (509 != GT_Utility.VERSION) || (509 != GT_RecipeRegistrator.VERSION) || (509 != Element.VERSION) || (509 != Materials.VERSION) || (509 != OrePrefixes.VERSION)) { throw new GT_ItsNotMyFaultException("One of your Mods included GregTech-API Files inside it's download, mention this to the Mod Author, who does this bad thing, and tell him/her to use reflection. I have added a Version check, to prevent Authors from breaking my Mod that way."); diff --git a/src/main/java/gregtech/api/enums/GuiColors.java b/src/main/java/gregtech/api/enums/GuiColors.java deleted file mode 100644 index 8c0a32954a..0000000000 --- a/src/main/java/gregtech/api/enums/GuiColors.java +++ /dev/null @@ -1,101 +0,0 @@ -package gregtech.api.enums; - -import gregtech.api.util.GT_Log; - -import java.util.function.Function; - -public enum GuiColors { - //RGB Colors: Name and default value - oneByOne(0x404040), - twoByTwo(0x404040), - twoByTwoFluid(0x404040), - twoByTwoFluidInventory(0x404040), - threeByThree(0x404040), - fourByFour(0x404040), - basicMachine(0x404040), - basicTankTitle(0x404040), - basicTankInventory(0x404040), - basicTankLiquidAmount(0xFAFAFF), - basicTankLiquidValue(0xFAFAFF), - maintenanceHatch(0x404040), - maintenanceHatchRepair(0x404040), - - multiMachineTitle(0xFAFAFF), - multiMachineDrillBaseText(0xFAFAFF), - multiMachineIncompleteStructure(0xFAFAFF), - multiMachineLargeTurbineText(0xFAFAFF), - multiMachineMaintenanceText(0xFAFAFF), - multiMachineMalletRestart(0xFAFAFF), - multiMachineRunningPerfectly(0xFAFAFF), - - outputHatchTitle(0x404040), - outputHatchInventory(0x404040), - outputHatchAmount(0xFAFAFF), - outputHatchValue(0xFAFAFF), - outputHatchFluidName(0xFAFAFF), - outputHatchLockedFluid(0xFAFAFF), - - boiler(0x404040), - bronzeBlastFurnace(0x404040), - fusionReactor(0xFF0000), - industrialApiary(0x404040), - microwaveEnergyTransmitter(0xFAFAFF), - primitiveBlastFurnace(0x404040), - quantumChestTitle(0x404040), - quantumChestAmount(0xFAFAFF), - regulator(0xFAFAFF), - teleporter(0xFAFAFF), - - fluidDisplayStackRenderer(0xFFFFFF), - - //ARGB Colors: Name and default value - dialogSelectItem(0xFF555555), - pollutionRenderer(0xFFFFFFFF), - screenText(0xFF222222), - - coverArm(0xFF555555), - coverControlsWork(0xFF555555), - coverConveyor(0xFF555555), - coverDoesWork(0xFF555555), - coverEUMeter(0xFF555555), - coverFluidFilterName(0xFF222222), - coverFluidFilter(0xFF555555), - coverFluidRegulatorWarn(0xFFFF0000), - coverFluidRegulator(0xFF555555), - coverItemFilter(0xFF555555), - coverItemMeter(0xFF555555), - coverLiquidMeter(0xFF555555), - coverMaintenance(0xFF555555), - coverPlayerDetector(0xFF555555), - coverPump(0xFF555555), - coverRedstoneWirelessBase(0xFF555555), - coverShutter(0xFF555555), - - NEIText(0xFF000000); - - private final int defaultColor; - private int color; - - GuiColors(final int hex) { - this.defaultColor = hex; - this.color = hex; - } - - public void reload(Function<String, String> l) { - color = this.defaultColor; - - String hex = l.apply("GT5U.gui.color." + this); - - try { - if (!hex.isEmpty()) { - color = Integer.parseUnsignedInt(hex, 16); - } - } catch (final NumberFormatException e) { - GT_Log.err.println("Couldn't format color correctly for: GT5U.gui.color." + this + " -> " + hex); - } - } - - public int getColor() { - return color; - } -} diff --git a/src/main/java/gregtech/api/gui/GT_GUIColorOverride.java b/src/main/java/gregtech/api/gui/GT_GUIColorOverride.java new file mode 100644 index 0000000000..c2a833503e --- /dev/null +++ b/src/main/java/gregtech/api/gui/GT_GUIColorOverride.java @@ -0,0 +1,39 @@ +package gregtech.api.gui; + +import gregtech.api.util.ColorsMetadataSection; +import gregtech.api.GregTech_API; +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.IResource; +import net.minecraft.util.ResourceLocation; + +import java.io.IOException; + +public class GT_GUIColorOverride { + + private ColorsMetadataSection cmSection; + + public GT_GUIColorOverride(String guiTexturePath) { + try { + IResource ir = Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation(guiTexturePath)); + if (ir.hasMetadata()) { + cmSection = (ColorsMetadataSection) ir.getMetadata("colors"); + } + } catch (IOException ignore) {} + } + + public int getTextColorOrDefault(String textType, int defaultColor) { + return sLoaded() ? cmSection.getTextColorOrDefault(textType, defaultColor) : defaultColor; + } + + public int getGuiTintOrDefault(String key, int defaultColor) { + return sLoaded() ? cmSection.getGuiTintOrDefault(key, defaultColor) : defaultColor; + } + + public boolean sGuiTintingEnabled() { + return sLoaded() ? cmSection.sGuiTintingEnabled() : GregTech_API.sColoredGUI; + } + + public boolean sLoaded() { + return cmSection != null; + } +} diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer.java b/src/main/java/gregtech/api/gui/GT_GUIContainer.java index 1f1ae9037e..5d3f0a59a1 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer.java @@ -1,5 +1,6 @@ package gregtech.api.gui; +import gregtech.api.gui.GT_GUIColorOverride; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.Tessellator; import net.minecraft.inventory.Container; @@ -7,6 +8,8 @@ import net.minecraft.inventory.Slot; import net.minecraft.util.ResourceLocation; import org.lwjgl.input.Mouse; +import java.io.IOException; + import static gregtech.GT_Mod.GT_FML_LOGGER; /** @@ -20,11 +23,18 @@ public class GT_GUIContainer extends GuiContainer { public ResourceLocation mGUIbackground; + public GT_GUIColorOverride colorOverride; + public String mGUIbackgroundPath; public GT_GUIContainer(Container aContainer, String aGUIbackground) { super(aContainer); mGUIbackground = new ResourceLocation(mGUIbackgroundPath = aGUIbackground); + colorOverride = new GT_GUIColorOverride(aGUIbackground); + } + + protected int getTextColorOrDefault(String textType, int defaultColor) { + return colorOverride.getTextColorOrDefault(textType, defaultColor); } public int getLeft() { diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainerMetaTile_Machine.java b/src/main/java/gregtech/api/gui/GT_GUIContainerMetaTile_Machine.java index d25abd9137..4ab5f9f921 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainerMetaTile_Machine.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainerMetaTile_Machine.java @@ -13,9 +13,10 @@ import gregtech.api.gui.widgets.GT_GuiTabLine.GT_ITabRenderer; import gregtech.api.gui.widgets.GT_GuiTooltipManager.GT_IToolTipRenderer; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.util.GT_TooltipDataCache; +import gregtech.api.util.GT_Util; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.entity.RenderItem; -import gregtech.api.util.GT_TooltipDataCache; import net.minecraft.entity.player.InventoryPlayer; import java.util.List; @@ -34,6 +35,8 @@ public class GT_GUIContainerMetaTile_Machine extends GT_GUIContainer implements protected GT_GuiTooltipManager mTooltipManager = new GT_GuiTooltipManager(); protected GT_TooltipDataCache mTooltipCache = new GT_TooltipDataCache(); + private final int guiTint; + // Cover Tabs support. Subclasses can override display position, style and visuals by overriding setupCoverTabs public GT_GuiCoverTabLine coverTabs; private static final int @@ -63,6 +66,8 @@ public class GT_GUIContainerMetaTile_Machine extends GT_GUIContainer implements if (GT_Mod.gregtechproxy.mTooltipVerbosity > 0 || GT_Mod.gregtechproxy.mTooltipShiftVerbosity > 0) { setupTooltips(); } + + guiTint = getColorization(); } public GT_GUIContainerMetaTile_Machine(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, @@ -106,8 +111,7 @@ public class GT_GUIContainerMetaTile_Machine extends GT_GUIContainer implements coverTabs.drawTabs(parTicks, mouseX, mouseY); // Applying machine coloration, which subclasses rely on - Dyes color = getColorization(); - GL11.glColor3ub((byte) color.mRGBa[0], (byte) color.mRGBa[1], (byte) color.mRGBa[2]); + GL11.glColor3ub((byte) ((guiTint >> 16) & 0xFF), (byte) ((guiTint >> 8) & 0xFF), (byte) (guiTint & 0xFF)); // Binding machine's own texture, which subclasses rely on being set super.drawGuiContainerBackgroundLayer(parTicks, mouseX, mouseY); @@ -116,20 +120,25 @@ public class GT_GUIContainerMetaTile_Machine extends GT_GUIContainer implements /** * @return The color used to render this machine's GUI */ - private Dyes getColorization() { - if (GregTech_API.sMachineMetalGUI) { - return Dyes.MACHINE_METAL; - } else if (GregTech_API.sColoredGUI && mContainer != null && mContainer.mTileEntity != null) { - byte colorByte = mContainer.mTileEntity.getColorization(); - Dyes color; - if (colorByte != -1) - color = Dyes.get(colorByte); - else - color = Dyes.MACHINE_METAL; - return color; - } else { - return Dyes.dyeWhite; + private int getColorization() { + Dyes dye = Dyes.dyeWhite; + if (this.colorOverride.sLoaded()) { + if (this.colorOverride.sGuiTintingEnabled()) { + dye = getDyeFromIndex(mContainer.mTileEntity.getColorization()); + return this.colorOverride.getGuiTintOrDefault(dye.mName, GT_Util.getRGBInt(dye.getRGBA())); + } + } else if (GregTech_API.sColoredGUI) { + if (GregTech_API.sMachineMetalGUI) { + dye = Dyes.MACHINE_METAL; + } else if (mContainer != null && mContainer.mTileEntity != null) { + dye = getDyeFromIndex(mContainer.mTileEntity.getColorization()); + } } + return GT_Util.getRGBInt(dye.getRGBA()); + } + + private Dyes getDyeFromIndex(short index) { + return index != -1 ? Dyes.get(index) : Dyes.MACHINE_METAL; } /** diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_1by1.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_1by1.java index 8682a77bae..7e85cb60f0 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_1by1.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_1by1.java @@ -1,6 +1,5 @@ package gregtech.api.gui; -import gregtech.api.enums.GuiColors; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; @@ -9,7 +8,7 @@ import static gregtech.api.enums.GT_Values.RES_PATH_GUI; public class GT_GUIContainer_1by1 extends GT_GUIContainerMetaTile_Machine { private final String mName; - private final int textColor = GuiColors.oneByOne.getColor(); + private final int textColor = this.getTextColorOrDefault("title", 0x404040); public GT_GUIContainer_1by1(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) { super(new GT_Container_1by1(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "1by1.png"); diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_2by2.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_2by2.java index 72afda851b..acefe12459 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_2by2.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_2by2.java @@ -1,6 +1,5 @@ package gregtech.api.gui; -import gregtech.api.enums.GuiColors; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; @@ -9,7 +8,7 @@ import static gregtech.api.enums.GT_Values.RES_PATH_GUI; public class GT_GUIContainer_2by2 extends GT_GUIContainerMetaTile_Machine { private final String mName; - private final int textColor = GuiColors.twoByTwo.getColor(); + private final int textColor = this.getTextColorOrDefault("title", 0x404040); public GT_GUIContainer_2by2(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) { super(new GT_Container_2by2(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "2by2.png"); diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_2by2_Fluid.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_2by2_Fluid.java index 860f33c2bb..afabaa0a80 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_2by2_Fluid.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_2by2_Fluid.java @@ -1,6 +1,5 @@ package gregtech.api.gui; -import gregtech.api.enums.GuiColors; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.StatCollector; @@ -10,9 +9,7 @@ import static gregtech.api.enums.GT_Values.RES_PATH_GUI; public class GT_GUIContainer_2by2_Fluid extends GT_GUIContainerMetaTile_Machine { private final String mName; - private final int - textColorTitle = GuiColors.twoByTwoFluid.getColor(), - textColorInventory = GuiColors.twoByTwoFluidInventory.getColor(); + private final int textColor = this.getTextColorOrDefault("title", 0x404040); public GT_GUIContainer_2by2_Fluid(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) { super(new GT_Container_2by2_Fluid(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "2by2fluid.png"); @@ -21,8 +18,8 @@ public class GT_GUIContainer_2by2_Fluid extends GT_GUIContainerMetaTile_Machine @Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { - fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 2, textColorInventory); - fontRendererObj.drawString(mName, 8, 6, textColorTitle); + fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 2, textColor); + fontRendererObj.drawString(mName, 8, 6, textColor); } @Override diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_3by3.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_3by3.java index 12b3f81754..c2911fc67f 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_3by3.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_3by3.java @@ -1,6 +1,5 @@ package gregtech.api.gui; -import gregtech.api.enums.GuiColors; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; @@ -9,7 +8,7 @@ import static gregtech.api.enums.GT_Values.RES_PATH_GUI; public class GT_GUIContainer_3by3 extends GT_GUIContainerMetaTile_Machine { private final String mName; - private final int textColor = GuiColors.threeByThree.getColor(); + private final int textColor = this.getTextColorOrDefault("title", 0x404040); public GT_GUIContainer_3by3(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) { super(new GT_Container_3by3(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "3by3.png"); diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_4by4.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_4by4.java index fa2695b633..b28129eede 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_4by4.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_4by4.java @@ -1,6 +1,5 @@ package gregtech.api.gui; -import gregtech.api.enums.GuiColors; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; @@ -9,7 +8,7 @@ import static gregtech.api.enums.GT_Values.RES_PATH_GUI; public class GT_GUIContainer_4by4 extends GT_GUIContainerMetaTile_Machine { private final String mName; - private final int textColor = GuiColors.fourByFour.getColor(); + private final int textColor = this.getTextColorOrDefault("title", 0x404040); public GT_GUIContainer_4by4(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) { super(new GT_Container_4by4(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "4by4.png"); diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicMachine.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicMachine.java index 29168a53bb..8f26c00216 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicMachine.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicMachine.java @@ -1,7 +1,6 @@ package gregtech.api.gui; import gregtech.api.enums.GT_Values; -import gregtech.api.enums.GuiColors; import gregtech.api.gui.widgets.GT_GuiIcon; import gregtech.api.gui.widgets.GT_GuiTabLine.GT_GuiTabIconSet; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -41,7 +40,7 @@ public class GT_GUIContainer_BasicMachine extends GT_GUIContainerMetaTile_Machin GT_GuiIcon.TAB_NORMAL_STEEL, GT_GuiIcon.TAB_HIGHLIGHT_STEEL, GT_GuiIcon.TAB_DISABLED_STEEL); - private final int textColor = GuiColors.basicMachine.getColor(); + private final int textColor = this.getTextColorOrDefault("title", 0x404040); public final String mName, mNEI; diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicTank.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicTank.java index 4a9e6751a6..a24060aaa4 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicTank.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_BasicTank.java @@ -1,6 +1,5 @@ package gregtech.api.gui; -import gregtech.api.enums.GuiColors; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.InventoryPlayer; @@ -11,11 +10,10 @@ import static gregtech.api.enums.GT_Values.RES_PATH_GUI; public class GT_GUIContainer_BasicTank extends GT_GUIContainerMetaTile_Machine { private final String mName; - private final int - textColorTitle = GuiColors.basicTankTitle.getColor(), - textColorInventory = GuiColors.basicTankInventory.getColor(), - textColorLiquidAmount = GuiColors.basicTankLiquidAmount.getColor(), - textColorLiquidValue = GuiColors.basicTankLiquidValue.getColor(); + private final int + textColor = this.getTextColorOrDefault("text", 0xFAFAFF), + textColorTitle = this.getTextColorOrDefault("title", 0x404040), + textColorValue = this.getTextColorOrDefault("value", 0xFAFAFF); public GT_GUIContainer_BasicTank(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) { super(new GT_Container_BasicTank(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "BasicTank.png"); @@ -24,11 +22,11 @@ public class GT_GUIContainer_BasicTank extends GT_GUIContainerMetaTile_Machine { @Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { - fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 2, textColorInventory); + fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 2, textColorTitle); fontRendererObj.drawString(mName, 8, 6, textColorTitle); if (mContainer != null) { - fontRendererObj.drawString("Liquid Amount", 10, 20, textColorLiquidAmount); - fontRendererObj.drawString(GT_Utility.parseNumberToString(((GT_Container_BasicTank) mContainer).mContent), 10, 30, textColorLiquidValue); + fontRendererObj.drawString("Liquid Amount", 10, 20, textColor); + fontRendererObj.drawString(GT_Utility.parseNumberToString(((GT_Container_BasicTank) mContainer).mContent), 10, 30, textColorValue); } } diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_MaintenanceHatch.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_MaintenanceHatch.java index e1b57e2028..fe3c47fa95 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_MaintenanceHatch.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_MaintenanceHatch.java @@ -1,6 +1,5 @@ package gregtech.api.gui; -import gregtech.api.enums.GuiColors; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; @@ -8,8 +7,8 @@ import static gregtech.api.enums.GT_Values.RES_PATH_GUI; public class GT_GUIContainer_MaintenanceHatch extends GT_GUIContainerMetaTile_Machine { private final int - textColorTitle = GuiColors.maintenanceHatch.getColor(), - textColorRepair = GuiColors.maintenanceHatchRepair.getColor(); + textColor = this.getTextColorOrDefault("text", 0x404040), + textColorTitle = this.getTextColorOrDefault("title", 0x404040); public GT_GUIContainer_MaintenanceHatch(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { @@ -19,7 +18,7 @@ public class GT_GUIContainer_MaintenanceHatch extends GT_GUIContainerMetaTile_Ma @Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { fontRendererObj.drawString("Maintenance Hatch", 8, 4, textColorTitle); - fontRendererObj.drawString("Click with Tool to repair.", 8, 12, textColorRepair); + fontRendererObj.drawString("Click with Tool to repair.", 8, 12, textColor); } @Override diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_MultiMachine.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_MultiMachine.java index 6943b33a21..69a3d26b2e 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_MultiMachine.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_MultiMachine.java @@ -1,6 +1,5 @@ package gregtech.api.gui; -import gregtech.api.enums.GuiColors; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; @@ -23,15 +22,9 @@ import static gregtech.api.enums.GT_Values.RES_PATH_GUI; public class GT_GUIContainer_MultiMachine extends GT_GUIContainerMetaTile_Machine { String mName = ""; - private final int - textColorTitle = GuiColors.multiMachineTitle.getColor(), - textColorMaintenance = GuiColors.multiMachineMaintenanceText.getColor(), - textColorIncompleteStructure = GuiColors.multiMachineIncompleteStructure.getColor(), - textColorMalletRestart = GuiColors.multiMachineMalletRestart.getColor(), - textColorRunningPerfectly = GuiColors.multiMachineRunningPerfectly.getColor(), - textColorDrillBase = GuiColors.multiMachineDrillBaseText.getColor(), - textColorLargeTurbine = GuiColors.multiMachineLargeTurbineText.getColor(); - + private final int + textColor = this.getTextColorOrDefault("text", 0xFAFAFF), + textColorTitle = this.getTextColorOrDefault("title", 0xFAFAFF); public GT_GUIContainer_MultiMachine(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile) { super(new GT_Container_MultiMachine(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "multimachines/" + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); @@ -84,61 +77,61 @@ public class GT_GUIContainer_MultiMachine extends GT_GUIContainerMetaTile_Machin if (mContainer != null) {//(mWrench ? 0 : 1) | (mScrewdriver ? 0 : 2) | (mSoftHammer ? 0 : 4) | (mHardHammer ? 0 : 8) | (mSolderingTool ? 0 : 16) | (mCrowbar ? 0 : 32) | (mMachine ? 0 : 64)); if ((mContainer.mDisplayErrorCode & 1) != 0) { - fontRendererObj.drawString(GT_Utility.trans("132", "Pipe is loose."), 10, line_counter, textColorMaintenance); + fontRendererObj.drawString(GT_Utility.trans("132", "Pipe is loose."), 10, line_counter, textColor); line_counter += 8; } if ((mContainer.mDisplayErrorCode & 2) != 0) { - fontRendererObj.drawString(GT_Utility.trans("133", "Screws are loose."), 10, line_counter, textColorMaintenance); + fontRendererObj.drawString(GT_Utility.trans("133", "Screws are loose."), 10, line_counter, textColor); line_counter += 8; } if ((mContainer.mDisplayErrorCode & 4) != 0) { - fontRendererObj.drawString(GT_Utility.trans("134", "Something is stuck."), 10, line_counter, textColorMaintenance); + fontRendererObj.drawString(GT_Utility.trans("134", "Something is stuck."), 10, line_counter, textColor); line_counter += 8; } if ((mContainer.mDisplayErrorCode & 8) != 0) { - fontRendererObj.drawString(GT_Utility.trans("135", "Platings are dented."), 10, line_counter, textColorMaintenance); + fontRendererObj.drawString(GT_Utility.trans("135", "Platings are dented."), 10, line_counter, textColor); line_counter += 8; } if ((mContainer.mDisplayErrorCode & 16) != 0) { - fontRendererObj.drawString(GT_Utility.trans("136", "Circuitry burned out."), 10, line_counter, textColorMaintenance); + fontRendererObj.drawString(GT_Utility.trans("136", "Circuitry burned out."), 10, line_counter, textColor); line_counter += 8; } if ((mContainer.mDisplayErrorCode & 32) != 0) { - fontRendererObj.drawString(GT_Utility.trans("137", "That doesn't belong there."), 10, line_counter, textColorMaintenance); + fontRendererObj.drawString(GT_Utility.trans("137", "That doesn't belong there."), 10, line_counter, textColor); line_counter += 8; } if ((mContainer.mDisplayErrorCode & 64) != 0) { - fontRendererObj.drawString(GT_Utility.trans("138", "Incomplete Structure."), 10, line_counter, textColorIncompleteStructure); + fontRendererObj.drawString(GT_Utility.trans("138", "Incomplete Structure."), 10, line_counter, textColor); line_counter += 8; } if (mContainer.mDisplayErrorCode == 0) { if (mContainer.mActive == 0) { - fontRendererObj.drawString(GT_Utility.trans("139", "Hit with Soft Mallet"), 10, line_counter, textColorMalletRestart); + fontRendererObj.drawString(GT_Utility.trans("139", "Hit with Soft Mallet"), 10, line_counter, textColor); line_counter += 8; - fontRendererObj.drawString(GT_Utility.trans("140", "to (re-)start the Machine"), 10, line_counter, textColorMalletRestart); + fontRendererObj.drawString(GT_Utility.trans("140", "to (re-)start the Machine"), 10, line_counter, textColor); line_counter += 8; - fontRendererObj.drawString(GT_Utility.trans("141", "if it doesn't start."), 10, line_counter, textColorMalletRestart); + fontRendererObj.drawString(GT_Utility.trans("141", "if it doesn't start."), 10, line_counter, textColor); line_counter += 8; } else { - fontRendererObj.drawString(GT_Utility.trans("142", "Running perfectly."), 10, line_counter, textColorRunningPerfectly); + fontRendererObj.drawString(GT_Utility.trans("142", "Running perfectly."), 10, line_counter, textColor); line_counter += 8; } if (mContainer.mTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_DrillerBase) { ItemStack tItem = mContainer.mTileEntity.getMetaTileEntity().getStackInSlot(1); if (tItem == null || !GT_Utility.areStacksEqual(tItem, GT_ModHandler.getIC2Item("miningPipe", 1L))) { - fontRendererObj.drawString(GT_Utility.trans("143", "Missing Mining Pipe"), 10, line_counter, textColorDrillBase); + fontRendererObj.drawString(GT_Utility.trans("143", "Missing Mining Pipe"), 10, line_counter, textColor); } } else if (mContainer.mTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_LargeTurbine) { ItemStack tItem = mContainer.mTileEntity.getMetaTileEntity().getStackInSlot(1); if (tItem == null || !(tItem.getItem() == GT_MetaGenerated_Tool_01.INSTANCE && tItem.getItemDamage() >= 170 && tItem.getItemDamage() <= 177)) { - fontRendererObj.drawString(GT_Utility.trans("144", "Missing Turbine Rotor"), 10, line_counter, textColorLargeTurbine); + fontRendererObj.drawString(GT_Utility.trans("144", "Missing Turbine Rotor"), 10, line_counter, textColor); } } } diff --git a/src/main/java/gregtech/api/gui/GT_GUIDialogSelectItem.java b/src/main/java/gregtech/api/gui/GT_GUIDialogSelectItem.java index 245803ebc7..0aec243967 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIDialogSelectItem.java +++ b/src/main/java/gregtech/api/gui/GT_GUIDialogSelectItem.java @@ -1,6 +1,5 @@ package gregtech.api.gui; -import gregtech.api.enums.GuiColors; import gregtech.api.gui.widgets.GT_GuiFakeItemButton; import gregtech.api.gui.widgets.GT_GuiIcon; import gregtech.api.gui.widgets.GT_GuiIconButton; @@ -18,7 +17,7 @@ public class GT_GUIDialogSelectItem extends GT_GUIScreen { public static final int UNSELECTED = -1; private static final int cols = 9; private static final int rows = 3; - private final int textColor = GuiColors.dialogSelectItem.getColor(); + private final int textColor = this.getTextColorOrDefault("text",0xff555555); private final GuiScreen parent; private final Consumer<ItemStack> selectedCallback; // passed in stack diff --git a/src/main/java/gregtech/api/gui/GT_GUIScreen.java b/src/main/java/gregtech/api/gui/GT_GUIScreen.java index 1b01f17ec8..1efaddea35 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIScreen.java +++ b/src/main/java/gregtech/api/gui/GT_GUIScreen.java @@ -1,7 +1,7 @@ package gregtech.api.gui; import gregtech.api.enums.Dyes; -import gregtech.api.enums.GuiColors; +import gregtech.api.gui.GT_GUIColorOverride; import gregtech.api.gui.widgets.GT_GuiFakeItemButton; import gregtech.api.gui.widgets.GT_GuiIntegerTextBox; import gregtech.api.gui.widgets.GT_GuiTooltip; @@ -19,6 +19,7 @@ import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; +import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -30,20 +31,27 @@ public abstract class GT_GUIScreen extends GuiScreen implements GT_IToolTipRende protected int gui_height = 107; protected int guiTop, guiLeft; protected boolean drawButtons = true; - private final int textColor = GuiColors.multiMachineTitle.getColor(); + + private ResourceLocation mGUIbackgroundLocation; private GuiButton selectedButton; + private GT_GUIColorOverride colorOverride; + private final int textColor; + private final static String guiTexturePath = "gregtech:textures/gui/GuiCover.png"; + public String header; public GT_GuiFakeItemButton headerIcon; - protected List<IGuiElement> elements = new ArrayList<>(); protected List<GT_GuiIntegerTextBox> textBoxes = new ArrayList<>(); public GT_GUIScreen(int width, int height, String header) { - this.gui_width = width; + this.gui_width = width; this.gui_height = height; this.header = header; this.headerIcon = new GT_GuiFakeItemButton(this, 5, 5, null); + this.mGUIbackgroundLocation = new ResourceLocation(guiTexturePath); + this.colorOverride = new GT_GUIColorOverride(guiTexturePath); + this.textColor = getTextColorOrDefault("title", 0xFF222222); } @Override @@ -68,6 +76,10 @@ public abstract class GT_GUIScreen extends GuiScreen implements GT_IToolTipRende protected abstract void onInitGui(int guiLeft, int guiTop, int gui_width, int gui_height); + protected int getTextColorOrDefault(String textType, int defaultColor) { + return colorOverride.getTextColorOrDefault(textType, defaultColor); + } + public void onMouseWheel(int x, int y, int delta) { } @@ -122,7 +134,7 @@ public abstract class GT_GUIScreen extends GuiScreen implements GT_IToolTipRende public void drawBackground(int mouseX, int mouseY, float parTicks) { short[] color = Dyes.MACHINE_METAL.getRGBA(); GL11.glColor3ub((byte) color[0], (byte) color[1], (byte) color[2]); - this.mc.renderEngine.bindTexture(new ResourceLocation("gregtech:textures/gui/GuiCover.png")); + this.mc.renderEngine.bindTexture(mGUIbackgroundLocation); drawTexturedModalRect(guiLeft, guiTop, 0,0, gui_width, gui_height); } diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiCoverTabLine.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiCoverTabLine.java index c470936db2..8f729771f6 100644 --- a/src/main/java/gregtech/api/gui/widgets/GT_GuiCoverTabLine.java +++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiCoverTabLine.java @@ -35,7 +35,7 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine { // Not sure there's a point in JIT translation but that's what this is private String[] translatedSides; private IGregTechTileEntity tile; - private Dyes colorization; + private int colorization; /** * Let's you access an IGregTechTileEntity's covers as tabs on the GUI's sides @@ -58,7 +58,7 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine { */ public GT_GuiCoverTabLine(GT_GUIContainerMetaTile_Machine gui, int tabLineLeft, int tabLineTop, int tabHeight, int tabWidth, int tabSpacing, DisplayStyle xDir, DisplayStyle yDir, DisplayStyle displayMode, - GT_GuiTabIconSet tabBackground, IGregTechTileEntity tile, Dyes colorization) { + GT_GuiTabIconSet tabBackground, IGregTechTileEntity tile, int colorization) { super(gui, 6, tabLineLeft, tabLineTop, tabHeight, tabWidth, tabSpacing, xDir, yDir, displayMode, tabBackground); this.tile = tile; this.colorization = colorization; @@ -81,7 +81,7 @@ public class GT_GuiCoverTabLine extends GT_GuiTabLine { @Override protected void drawBackground(float parTicks, int mouseX, int mouseY) { // Apply this tile's coloration to draw the background - GL11.glColor3ub((byte) colorization.mRGBa[0], (byte) colorization.mRGBa[1], (byte) colorization.mRGBa[2]); + GL11.glColor3ub((byte) ((colorization >> 16) & 0xFF), (byte) ((colorization >> 8) & 0xFF), (byte) (colorization & 0xFF)); super.drawBackground(parTicks, mouseX, mouseY); } diff --git a/src/main/java/gregtech/api/util/ColorsMetadataSection.java b/src/main/java/gregtech/api/util/ColorsMetadataSection.java new file mode 100644 index 0000000000..2851435061 --- /dev/null +++ b/src/main/java/gregtech/api/util/ColorsMetadataSection.java @@ -0,0 +1,61 @@ +package gregtech.api.util; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import java.util.Map; +import java.util.HashMap; +import gregtech.api.util.GT_Log; +import gregtech.api.GregTech_API; +import net.minecraft.client.resources.data.IMetadataSection; + +@SideOnly(Side.CLIENT) +public class ColorsMetadataSection implements IMetadataSection { + private final Map<String, Integer> textColors; + private final Map<String, String> hexTextColors; + private final Map<String, Integer> guiTints; + private final Map<String, String> hexGuiTints; + private final boolean guiTintEnabled; + + public ColorsMetadataSection(Map<String, String> hexTextColorMap, Map<String, String> hexGuiTintMap, boolean guiTintEnabled) { + this.hexTextColors = hexTextColorMap; + this.textColors = convertHexMapToIntMap(hexTextColorMap); + + this.hexGuiTints = hexGuiTintMap; + this.guiTints = convertHexMapToIntMap(hexGuiTintMap); + + this.guiTintEnabled = guiTintEnabled; + } + + private Map<String, Integer> convertHexMapToIntMap(Map <String, String> hexMap) { + Map<String, Integer> intMap = new HashMap<>(); + + for (String key : hexMap.keySet()) { + int colorValue = -1; + String hex = hexMap.get(key); + try { + if (!hex.isEmpty()) colorValue = Integer.parseUnsignedInt(hex,16); + } + catch (final NumberFormatException e) { + GT_Log.err.println("Couldn't format color correctly of " + key + " -> " + hex); + } + intMap.put(key, colorValue); + } + return intMap; + } + + public int getTextColorOrDefault(String key, int defaultColor) { + return sColorInMap(key, this.hexTextColors) ? defaultColor : this.textColors.get(key); + } + + public int getGuiTintOrDefault(String key, int defaultColor) { + return sColorInMap(key, this.hexGuiTints) ? defaultColor : this.guiTints.get(key); + } + + private boolean sColorInMap(String key, Map<String,String> hexMap) { + return hexMap.containsKey(key) && hexMap.get(key).isEmpty(); + } + + public boolean sGuiTintingEnabled() { + return this.guiTintEnabled; + } +} diff --git a/src/main/java/gregtech/api/util/ColorsMetadataSectionSerializer.java b/src/main/java/gregtech/api/util/ColorsMetadataSectionSerializer.java new file mode 100644 index 0000000000..4de8463685 --- /dev/null +++ b/src/main/java/gregtech/api/util/ColorsMetadataSectionSerializer.java @@ -0,0 +1,71 @@ +package gregtech.api.util; + +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import java.lang.reflect.Type; +import java.util.Map; +import java.util.HashMap; +import gregtech.api.GregTech_API; +import gregtech.api.enums.Dyes; +import net.minecraft.util.JsonUtils; +import net.minecraft.client.resources.data.BaseMetadataSectionSerializer; + +@SideOnly(Side.CLIENT) +public class ColorsMetadataSectionSerializer extends BaseMetadataSectionSerializer implements JsonSerializer { + public ColorsMetadataSection deserialize(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", ""); + }}; + + 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, "")); + } + } + + if (jsonObject.has("guiTint")) { + JsonObject guiTints = JsonUtils.func_152754_s(jsonObject, "guiTint"); + enableGuiTint = JsonUtils.getJsonObjectBooleanFieldValueOrDefault(guiTints, "enableGuiTintWhenPainted", true); + + for (Dyes dye : Dyes.values()) { + hexGuiTintMap.put(dye.mName, GT_Util.toHexString(dye.getRGBA())); + } + + for (String key : hexGuiTintMap.keySet()) { + if (enableGuiTint) { + hexGuiTintMap.replace(key, JsonUtils.getJsonObjectStringFieldValueOrDefault(guiTints, key, hexGuiTintMap.get(key))); + } else { + hexGuiTintMap.replace(key, GT_Util.toHexString(Dyes.dyeWhite.getRGBA())); + } + } + } + + return new ColorsMetadataSection(hexTextColorMap, hexGuiTintMap, enableGuiTint); + } + + public JsonElement serialize(ColorsMetadataSection colorsMetaSection, Type type, JsonSerializationContext context) { + JsonObject jsonObject = new JsonObject(); + return jsonObject; + } + + public String getSectionName() { + return "colors"; + } + + public JsonElement serialize(Object object, Type type, JsonSerializationContext context) { + return this.serialize((ColorsMetadataSection) object, type, context); + } +} diff --git a/src/main/java/gregtech/api/util/GT_Util.java b/src/main/java/gregtech/api/util/GT_Util.java index 1079da6c26..45c005bdff 100644 --- a/src/main/java/gregtech/api/util/GT_Util.java +++ b/src/main/java/gregtech/api/util/GT_Util.java @@ -132,6 +132,10 @@ public class GT_Util { return aColors == null ? 16777215 : (aColors[0]) << 16 | (aColors[1] << 8) | aColors[2] | (aColors[3] << 24); } + public static String toHexString(short[] aColors) { + return aColors == null ? "FFFFFF" : Integer.toString((aColors[0] << 16) | (aColors[1] << 8) | aColors[2], 16); + } + public static int getRGBInt(short aR, short aG, short aB) { return (aR << 16) | (aG << 8) | aB; } diff --git a/src/main/java/gregtech/common/GT_Client.java b/src/main/java/gregtech/common/GT_Client.java index 0d2a76731b..f849da7594 100644 --- a/src/main/java/gregtech/common/GT_Client.java +++ b/src/main/java/gregtech/common/GT_Client.java @@ -27,6 +27,8 @@ import gregtech.api.interfaces.tileentity.ITurnable; import gregtech.api.metatileentity.BaseMetaPipeEntity; import gregtech.api.net.GT_Packet_ClientPreference; import gregtech.api.objects.GT_ItemStack; +import gregtech.api.util.ColorsMetadataSection; +import gregtech.api.util.ColorsMetadataSectionSerializer; import gregtech.api.util.GT_ClientPreference; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_PlayedSound; @@ -39,7 +41,6 @@ import gregtech.common.entities.GT_Entity_Arrow_Potion; import gregtech.common.net.MessageUpdateFluidDisplayItem; import gregtech.common.render.*; import gregtech.loaders.ExtraIcons; -import gregtech.loaders.misc.GT_JsonLoader; import gregtech.loaders.preload.GT_PreLoad; import ic2.api.tile.IWrenchable; import net.minecraft.block.Block; @@ -401,10 +402,7 @@ public class GT_Client extends GT_Proxy super.onPreLoad(); MinecraftForge.EVENT_BUS.register(new ExtraIcons()); - GT_Mod.jsonGuiColors = new GT_JsonLoader("textures/guiColors.json"); - for (GuiColors value : GuiColors.values()) { - GT_Mod.jsonGuiColors.registerReloadListener(l -> value.reload(l::getString)); - } + Minecraft.getMinecraft().getResourcePackRepository().rprMetadataSerializer.registerMetadataSectionType(new ColorsMetadataSectionSerializer(), ColorsMetadataSection.class); final String[] arr = { "renadi", "hanakocz", "MysteryDump", "Flaver4", "x_Fame", "Peluche321", "Goshen_Ithilien", "manf", "Bimgo", "leagris", diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Arm.java b/src/main/java/gregtech/common/covers/GT_Cover_Arm.java index 8a33007caa..23802851c7 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_Arm.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_Arm.java @@ -1,7 +1,6 @@ package gregtech.common.covers; import gregtech.api.enums.GT_Values; -import gregtech.api.enums.GuiColors; import gregtech.api.gui.GT_GUICover; import gregtech.api.gui.widgets.GT_GuiFakeItemButton; import gregtech.api.gui.widgets.GT_GuiIcon; @@ -247,7 +246,7 @@ public class GT_Cover_Arm extends GT_CoverBehavior { private final int maxIntSlot, maxAdjSlot; - private final int textColor = GuiColors.coverArm.getColor(); + private final int textColor = this.getTextColorOrDefault("text", 0xFF555555); public GUI(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { super(aTileEntity, 176, 107, GT_Utility.intToStack(aCoverID)); diff --git a/src/main/java/gregtech/common/covers/GT_Cover_ControlsWork.java b/src/main/java/gregtech/common/covers/GT_Cover_ControlsWork.java index fce84264ee..dd2b17df05 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_ControlsWork.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_ControlsWork.java @@ -1,7 +1,6 @@ package gregtech.common.covers; import gregtech.api.enums.GT_Values; -import gregtech.api.enums.GuiColors; import gregtech.api.gui.GT_GUICover; import gregtech.api.gui.widgets.GT_GuiIcon; import gregtech.api.gui.widgets.GT_GuiIconButton; @@ -162,7 +161,7 @@ public class GT_Cover_ControlsWork extends GT_CoverBehavior { private static final int spaceX = 18; private static final int spaceY = 18; - private final int textColor = GuiColors.coverControlsWork.getColor(); + private final int textColor = this.getTextColorOrDefault("text", 0xFF555555); public GUI(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { super(aTileEntity, 176, 107, GT_Utility.intToStack(aCoverID)); diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Conveyor.java b/src/main/java/gregtech/common/covers/GT_Cover_Conveyor.java index 2d9a59116b..9e0fd84a6c 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_Conveyor.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_Conveyor.java @@ -1,7 +1,6 @@ package gregtech.common.covers; import gregtech.api.enums.GT_Values; -import gregtech.api.enums.GuiColors; import gregtech.api.gui.GT_GUICover; import gregtech.api.gui.widgets.GT_GuiIcon; import gregtech.api.gui.widgets.GT_GuiIconButton; @@ -161,7 +160,7 @@ public class GT_Cover_Conveyor extends GT_CoverBehavior { private static final int spaceX = 18; private static final int spaceY = 18; - private final int textColor = GuiColors.coverPlayerDetector.getColor(); + private final int textColor = this.getTextColorOrDefault("text", 0xFF555555); public GUI(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { super(aTileEntity, 176, 107, GT_Utility.intToStack(aCoverID)); diff --git a/src/main/java/gregtech/common/covers/GT_Cover_DoesWork.java b/src/main/java/gregtech/common/covers/GT_Cover_DoesWork.java index b64ba83fe1..366b896d45 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_DoesWork.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_DoesWork.java @@ -1,7 +1,6 @@ package gregtech.common.covers; import gregtech.api.enums.GT_Values; -import gregtech.api.enums.GuiColors; import gregtech.api.gui.GT_GUICover; import gregtech.api.gui.widgets.GT_GuiIcon; import gregtech.api.gui.widgets.GT_GuiIconButton; @@ -121,7 +120,7 @@ public class GT_Cover_DoesWork extends GT_CoverBehavior { private static final int spaceX = 18; private static final int spaceY = 18; - private final int textColor = GuiColors.coverDoesWork.getColor(); + private final int textColor = this.getTextColorOrDefault("text", 0xFF555555); public GUI(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { super(aTileEntity, 176, 107, GT_Utility.intToStack(aCoverID)); diff --git a/src/main/java/gregtech/common/covers/GT_Cover_EUMeter.java b/src/main/java/gregtech/common/covers/GT_Cover_EUMeter.java index 0c99f8b4c8..1f59049828 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_EUMeter.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_EUMeter.java @@ -2,7 +2,6 @@ package gregtech.common.covers; import com.google.common.io.ByteArrayDataInput; import gregtech.api.enums.GT_Values; -import gregtech.api.enums.GuiColors; import gregtech.api.gui.GT_GUICover; import gregtech.api.gui.widgets.GT_GuiIcon; import gregtech.api.gui.widgets.GT_GuiIconButton; @@ -373,7 +372,7 @@ public class GT_Cover_EUMeter extends GT_CoverBehaviorBase<GT_Cover_EUMeter.EUMe private final String INVERTED = GT_Utility.trans("INVERTED", "Inverted"); private final String NORMAL = GT_Utility.trans("NORMAL", "Normal"); - private final int textColor = GuiColors.coverEUMeter.getColor(); + private final int textColor = this.getTextColorOrDefault("text", 0xFF555555); public GUI(byte aSide, int aCoverID, EUMeterData aCoverVariable, ICoverable aTileEntity) { super(aTileEntity, 176, 107, GT_Utility.intToStack(aCoverID)); diff --git a/src/main/java/gregtech/common/covers/GT_Cover_FacadeBase.java b/src/main/java/gregtech/common/covers/GT_Cover_FacadeBase.java index bfdc56c157..d35d0dbddd 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_FacadeBase.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_FacadeBase.java @@ -265,6 +265,8 @@ public abstract class GT_Cover_FacadeBase extends GT_CoverBehaviorBase<GT_Cover_ private static final int spaceX = 18; private static final int spaceY = 18; + private final int textColor = this.getTextColorOrDefault("text", 0xFF555555); + public GUI(byte aSide, int aCoverID, FacadeData aCoverVariable, ICoverable aTileEntity) { super(aTileEntity, 176, 107, aCoverVariable.mStack); this.side = aSide; @@ -280,10 +282,10 @@ public abstract class GT_Cover_FacadeBase extends GT_CoverBehaviorBase<GT_Cover_ @Override public void drawExtras(int mouseX, int mouseY, float parTicks) { super.drawExtras(mouseX, mouseY, parTicks); - this.fontRendererObj.drawString(GT_Utility.trans("128", "Redstone"), 3 + startX + spaceX * 1, 4 + startY + spaceY * 0, 0xFF555555); - this.fontRendererObj.drawString(GT_Utility.trans("129", "Energy"), 3 + startX + spaceX * 1, 4 + startY + spaceY * 1, 0xFF555555); - this.fontRendererObj.drawString(GT_Utility.trans("130", "Fluids"), 3 + startX + spaceX * 1, 4 + startY + spaceY * 2, 0xFF555555); - this.fontRendererObj.drawString(GT_Utility.trans("131", "Items"), 3 + startX + spaceX * 1, 4 + startY + spaceY * 3, 0xFF555555); + this.fontRendererObj.drawString(GT_Utility.trans("128", "Redstone"), 3 + startX + spaceX * 1, 4 + startY + spaceY * 0, textColor); + this.fontRendererObj.drawString(GT_Utility.trans("129", "Energy"), 3 + startX + spaceX * 1, 4 + startY + spaceY * 1, textColor); + this.fontRendererObj.drawString(GT_Utility.trans("130", "Fluids"), 3 + startX + spaceX * 1, 4 + startY + spaceY * 2, textColor); + this.fontRendererObj.drawString(GT_Utility.trans("131", "Items"), 3 + startX + spaceX * 1, 4 + startY + spaceY * 3, textColor); } @Override diff --git a/src/main/java/gregtech/common/covers/GT_Cover_FluidLimiter.java b/src/main/java/gregtech/common/covers/GT_Cover_FluidLimiter.java index cff6c2dd7e..4536cef710 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_FluidLimiter.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_FluidLimiter.java @@ -177,7 +177,7 @@ public class GT_Cover_FluidLimiter extends GT_CoverBehaviorBase<GT_Cover_FluidLi private final FluidLimiterData coverVariable; private final GT_GuiIntegerTextBox thresholdBox; - + private final int textColor = this.getTextColorOrDefault("text", 0xFF555555); public GUI(byte aSide, int aCoverID, FluidLimiterData aCoverVariable, ICoverable aTileEntity) { super(aTileEntity, 176, 107, GT_Utility.intToStack(aCoverID)); @@ -196,7 +196,7 @@ public class GT_Cover_FluidLimiter extends GT_CoverBehaviorBase<GT_Cover_FluidLi @Override public void drawExtras(int mouseX, int mouseY, float parTicks) { super.drawExtras(mouseX, mouseY, parTicks); - this.getFontRenderer().drawString("Percent threshold", startX, startY + spaceY * 2 - 35, 0xFF555555); + this.getFontRenderer().drawString("Percent threshold", startX, startY + spaceY * 2 - 35, textColor); } @Override diff --git a/src/main/java/gregtech/common/covers/GT_Cover_FluidRegulator.java b/src/main/java/gregtech/common/covers/GT_Cover_FluidRegulator.java index c8828aa026..947635369a 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_FluidRegulator.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_FluidRegulator.java @@ -2,7 +2,6 @@ package gregtech.common.covers; import com.google.common.io.ByteArrayDataInput; import gregtech.api.enums.GT_Values; -import gregtech.api.enums.GuiColors; import gregtech.api.gui.GT_GUICover; import gregtech.api.gui.widgets.GT_GuiIcon; import gregtech.api.gui.widgets.GT_GuiIconButton; @@ -358,8 +357,8 @@ public class GT_Cover_FluidRegulator extends GT_CoverBehaviorBase<GT_Cover_Fluid private boolean warn = false; private final int - textColor = GuiColors.coverFluidRegulator.getColor(), - textColorWarn = GuiColors.coverFluidRegulatorWarn.getColor(); + textColor = this.getTextColorOrDefault("text", 0xFF555555), + textColorValue = this.getTextColorOrDefault("value", 0xFFFF0000); public GUI(byte aSide, int aCoverID, FluidRegulatorData aCoverVariable, ICoverable aTileEntity) { super(aTileEntity, 176, 107, GT_Utility.intToStack(aCoverID)); @@ -399,7 +398,7 @@ public class GT_Cover_FluidRegulator extends GT_CoverBehaviorBase<GT_Cover_Fluid this.getFontRenderer().drawString(GT_Utility.trans("229", "Conditional"), startX + spaceX * 4, 4 + startY + spaceY * 1, textColor); this.getFontRenderer().drawString(GT_Utility.trans("208", " L"), startX + spaceX * 4, 4 + startY + spaceY * 2, textColor); this.getFontRenderer().drawString(GT_Utility.trans("209", " ticks"), startX + spaceX * 7, 4 + startY + spaceY * 2, textColor); - this.getFontRenderer().drawString(String.format(GT_Utility.trans("210", "Average: %.2f L/sec"), coverVariable.tickRate == 0 ? 0 : coverVariable.speed * 20d / coverVariable.tickRate), startX + spaceX * 0, 4 + startY + spaceY * 3, warn ? textColorWarn : textColor); + this.getFontRenderer().drawString(String.format(GT_Utility.trans("210", "Average: %.2f L/sec"), coverVariable.tickRate == 0 ? 0 : coverVariable.speed * 20d / coverVariable.tickRate), startX + spaceX * 0, 4 + startY + spaceY * 3, warn ? textColorValue : textColor); } @Override diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Fluidfilter.java b/src/main/java/gregtech/common/covers/GT_Cover_Fluidfilter.java index 004d459bad..c90a0fb07e 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_Fluidfilter.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_Fluidfilter.java @@ -2,7 +2,6 @@ package gregtech.common.covers; import com.google.common.io.ByteArrayDataInput; import gregtech.api.enums.GT_Values; -import gregtech.api.enums.GuiColors; import gregtech.api.gui.GT_GUICover; import gregtech.api.gui.widgets.GT_GuiFakeItemButton; import gregtech.api.gui.widgets.GT_GuiIcon; @@ -206,8 +205,8 @@ public class GT_Cover_Fluidfilter extends GT_CoverBehaviorBase<GT_Cover_Fluidfil private static final int spaceY = 18; private final int - textColor = GuiColors.coverFluidFilter.getColor(), - textColorFluidFilterName = GuiColors.coverFluidFilterName.getColor(); + textColor = this.getTextColorOrDefault("text", 0xFF555555), + textColorTitle = this.getTextColorOrDefault("title", 0xFF222222); public GT_FluidFilterGUICover(byte aSide, int aCoverID, FluidFilterData aCoverVariable, ICoverable aTileEntity) { super(aTileEntity, 176, 107, GT_Utility.intToStack(aCoverID)); @@ -264,10 +263,10 @@ public class GT_Cover_Fluidfilter extends GT_CoverBehaviorBase<GT_Cover_Fluidfil @Override public void drawExtras(int mouseX, int mouseY, float parTicks) { super.drawExtras(mouseX, mouseY, parTicks); - this.fontRendererObj.drawString(GT_Utility.trans("238", "Filter Direction"), startX + spaceX*2, 3+startY+spaceY*0, textColor); - this.fontRendererObj.drawString(GT_Utility.trans("239", "Filter Type"), startX + spaceX*2, 3+startY+spaceY*1, textColor); + this.fontRendererObj.drawString(GT_Utility.trans("238", "Filter Direction"), startX + spaceX*2, 3+startY+spaceY*0, textColor); + this.fontRendererObj.drawString(GT_Utility.trans("239", "Filter Type"), startX + spaceX*2, 3+startY+spaceY*1, textColor); this.fontRendererObj.drawString(GT_Utility.trans("240", "Block Flow"), startX + spaceX*2, 3+startY+spaceY*2, textColor); - this.fontRendererObj.drawSplitString(fluidFilterName, startX + spaceX+3, 4+startY+spaceY*3, gui_width-40 , textColorFluidFilterName); + this.fontRendererObj.drawSplitString(fluidFilterName, startX + spaceX+3, 4+startY+spaceY*3, gui_width-40 , textColorTitle); } @Override diff --git a/src/main/java/gregtech/common/covers/GT_Cover_ItemFilter.java b/src/main/java/gregtech/common/covers/GT_Cover_ItemFilter.java index ef13e7c0aa..f6b37316b2 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_ItemFilter.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_ItemFilter.java @@ -3,7 +3,6 @@ package gregtech.common.covers; import com.google.common.io.ByteArrayDataInput; import cpw.mods.fml.common.network.ByteBufUtils; import gregtech.api.enums.GT_Values; -import gregtech.api.enums.GuiColors; import gregtech.api.gui.GT_GUICover; import gregtech.api.gui.widgets.GT_GuiFakeItemButton; import gregtech.api.gui.widgets.GT_GuiIcon; @@ -220,7 +219,7 @@ public class GT_Cover_ItemFilter extends GT_CoverBehaviorBase<GT_Cover_ItemFilte private static final int spaceX = 18; private static final int spaceY = 18; - private final int textColor = GuiColors.coverItemFilter.getColor(); + private final int textColor = this.getTextColorOrDefault("text", 0xFF555555); public GUI(byte aSide, int aCoverID, ItemFilterData aCoverVariable, ICoverable aTileEntity) { super(aTileEntity, 176, 107, GT_Utility.intToStack(aCoverID)); diff --git a/src/main/java/gregtech/common/covers/GT_Cover_ItemMeter.java b/src/main/java/gregtech/common/covers/GT_Cover_ItemMeter.java index a157377315..846e115bd8 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_ItemMeter.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_ItemMeter.java @@ -4,7 +4,6 @@ import com.google.common.io.ByteArrayDataInput; import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; -import gregtech.api.enums.GuiColors; import gregtech.api.gui.GT_GUICover; import gregtech.api.gui.widgets.GT_GuiFakeItemButton; import gregtech.api.gui.widgets.GT_GuiIcon; @@ -288,7 +287,7 @@ public class GT_Cover_ItemMeter extends GT_CoverBehaviorBase<GT_Cover_ItemMeter. private final String INVERTED = GT_Utility.trans("INVERTED", "Inverted"); private final String NORMAL = GT_Utility.trans("NORMAL", "Normal"); - private final int textColor = GuiColors.coverItemMeter.getColor(); + private final int textColor = this.getTextColorOrDefault("text", 0xFF555555); public GUI(byte aSide, int aCoverID, ItemMeterData aCoverVariable, ICoverable aTileEntity) { super(aTileEntity, 176, 107, GT_Utility.intToStack(aCoverID)); diff --git a/src/main/java/gregtech/common/covers/GT_Cover_LiquidMeter.java b/src/main/java/gregtech/common/covers/GT_Cover_LiquidMeter.java index 40a10ad28b..3d5074a686 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_LiquidMeter.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_LiquidMeter.java @@ -2,7 +2,6 @@ package gregtech.common.covers; import com.google.common.io.ByteArrayDataInput; import gregtech.api.enums.GT_Values; -import gregtech.api.enums.GuiColors; import gregtech.api.gui.GT_GUICover; import gregtech.api.gui.widgets.GT_GuiIcon; import gregtech.api.gui.widgets.GT_GuiIconCheckButton; @@ -232,7 +231,7 @@ public class GT_Cover_LiquidMeter extends GT_CoverBehaviorBase<GT_Cover_LiquidMe private final String INVERTED = GT_Utility.trans("INVERTED", "Inverted"); private final String NORMAL = GT_Utility.trans("NORMAL", "Normal"); - private final int textColor = GuiColors.coverLiquidMeter.getColor(); + private final int textColor = this.getTextColorOrDefault("text", 0xFF555555); public GUI(byte aSide, int aCoverID, LiquidMeterData aCoverVariable, ICoverable aTileEntity) { super(aTileEntity, 176, 107, GT_Utility.intToStack(aCoverID)); diff --git a/src/main/java/gregtech/common/covers/GT_Cover_NeedMaintainance.java b/src/main/java/gregtech/common/covers/GT_Cover_NeedMaintainance.java index e7b3f15c86..dc4dc7c56e 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_NeedMaintainance.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_NeedMaintainance.java @@ -1,7 +1,6 @@ package gregtech.common.covers; import gregtech.api.enums.GT_Values; -import gregtech.api.enums.GuiColors; import gregtech.api.gui.GT_GUICover; import gregtech.api.gui.widgets.GT_GuiIcon; import gregtech.api.gui.widgets.GT_GuiIconCheckButton; @@ -207,7 +206,7 @@ public class GT_Cover_NeedMaintainance extends GT_CoverBehavior { private static final int spaceX = 18; private static final int spaceY = 18; - private final int textColor = GuiColors.coverMaintenance.getColor(); + private final int textColor = this.getTextColorOrDefault("text", 0xFF555555); public GUI(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { super(aTileEntity, 176, 107, GT_Utility.intToStack(aCoverID)); diff --git a/src/main/java/gregtech/common/covers/GT_Cover_PlayerDetector.java b/src/main/java/gregtech/common/covers/GT_Cover_PlayerDetector.java index 1ba0a97c50..4bcb119e84 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_PlayerDetector.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_PlayerDetector.java @@ -1,7 +1,6 @@ package gregtech.common.covers; import gregtech.api.enums.GT_Values; -import gregtech.api.enums.GuiColors; import gregtech.api.gui.GT_GUICover; import gregtech.api.gui.widgets.GT_GuiIcon; import gregtech.api.gui.widgets.GT_GuiIconCheckButton; @@ -143,7 +142,7 @@ public class GT_Cover_PlayerDetector extends GT_CoverBehavior { private static final int spaceX = 18; private static final int spaceY = 18; - private final int textColor = GuiColors.coverPlayerDetector.getColor(); + private final int textColor = this.getTextColorOrDefault("text", 0xFF555555); public GUI(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { super(aTileEntity, 176, 107, GT_Utility.intToStack(aCoverID)); diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Pump.java b/src/main/java/gregtech/common/covers/GT_Cover_Pump.java index ba71d7bd52..e92f3f1370 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_Pump.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_Pump.java @@ -1,7 +1,6 @@ package gregtech.common.covers; import gregtech.api.enums.GT_Values; -import gregtech.api.enums.GuiColors; import gregtech.api.gui.GT_GUICover; import gregtech.api.gui.widgets.GT_GuiIcon; import gregtech.api.gui.widgets.GT_GuiIconButton; @@ -186,7 +185,7 @@ public class GT_Cover_Pump extends GT_CoverBehavior{ private static final int spaceX = 18; private static final int spaceY = 18; - private final int textColor = GuiColors.coverPump.getColor(); + private final int textColor = this.getTextColorOrDefault("text", 0xFF555555); public GT_PumpGUICover(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { super(aTileEntity, 176, 107, GT_Utility.intToStack(aCoverID)); diff --git a/src/main/java/gregtech/common/covers/GT_Cover_RedstoneWirelessBase.java b/src/main/java/gregtech/common/covers/GT_Cover_RedstoneWirelessBase.java index 1f6f40a008..b60270ea58 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_RedstoneWirelessBase.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_RedstoneWirelessBase.java @@ -2,7 +2,6 @@ package gregtech.common.covers; import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; -import gregtech.api.enums.GuiColors; import gregtech.api.gui.GT_GUICover; import gregtech.api.gui.widgets.GT_GuiIcon; import gregtech.api.gui.widgets.GT_GuiIconCheckButton; @@ -160,7 +159,7 @@ public abstract class GT_Cover_RedstoneWirelessBase extends GT_CoverBehavior { private static final int spaceX = 18; private static final int spaceY = 18; - private final int textColor = GuiColors.coverRedstoneWirelessBase.getColor(); + private final int textColor = this.getTextColorOrDefault("text", 0xFF555555); public GUI(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { super(aTileEntity, 176, 107, GT_Utility.intToStack(aCoverID)); diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Shutter.java b/src/main/java/gregtech/common/covers/GT_Cover_Shutter.java index 06c31f7ffe..bf6ecc3a56 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_Shutter.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_Shutter.java @@ -1,7 +1,6 @@ package gregtech.common.covers; import gregtech.api.enums.GT_Values; -import gregtech.api.enums.GuiColors; import gregtech.api.gui.GT_GUICover; import gregtech.api.gui.widgets.GT_GuiIcon; import gregtech.api.gui.widgets.GT_GuiIconCheckButton; @@ -127,7 +126,7 @@ public class GT_Cover_Shutter extends GT_CoverBehavior { private static final int spaceX = 18; private static final int spaceY = 18; - private final int textColor = GuiColors.coverShutter.getColor(); + private final int textColor = this.getTextColorOrDefault("text", 0xFF555555); public GUI(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { super(aTileEntity, 176, 107, GT_Utility.intToStack(aCoverID)); diff --git a/src/main/java/gregtech/common/gui/GT_GUIContainer_Boiler.java b/src/main/java/gregtech/common/gui/GT_GUIContainer_Boiler.java index 9d4b23975a..0c9b6e1f93 100644 --- a/src/main/java/gregtech/common/gui/GT_GUIContainer_Boiler.java +++ b/src/main/java/gregtech/common/gui/GT_GUIContainer_Boiler.java @@ -1,13 +1,12 @@ package gregtech.common.gui; -import gregtech.api.enums.GuiColors; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; public class GT_GUIContainer_Boiler extends GT_GUIContainerMetaTile_Machine { - private final int textColor = GuiColors.boiler.getColor(); + private final int textColor = this.getTextColorOrDefault("title", 0x404040); public GT_GUIContainer_Boiler(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aTextureName) { super(new GT_Container_Boiler(aInventoryPlayer, aTileEntity), "gregtech:textures/gui/" + aTextureName); diff --git a/src/main/java/gregtech/common/gui/GT_GUIContainer_BronzeBlastFurnace.java b/src/main/java/gregtech/common/gui/GT_GUIContainer_BronzeBlastFurnace.java index d18b61410f..6e51d85f32 100644 --- a/src/main/java/gregtech/common/gui/GT_GUIContainer_BronzeBlastFurnace.java +++ b/src/main/java/gregtech/common/gui/GT_GUIContainer_BronzeBlastFurnace.java @@ -1,13 +1,12 @@ package gregtech.common.gui; -import gregtech.api.enums.GuiColors; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; public class GT_GUIContainer_BronzeBlastFurnace extends GT_GUIContainerMetaTile_Machine { - private final int textColor = GuiColors.bronzeBlastFurnace.getColor(); + private final int textColor = this.getTextColorOrDefault("title", 0x404040); public GT_GUIContainer_BronzeBlastFurnace(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { super(new GT_Container_BronzeBlastFurnace(aInventoryPlayer, aTileEntity), "gregtech:textures/gui/BronzeBlastFurnace.png"); diff --git a/src/main/java/gregtech/common/gui/GT_GUIContainer_FusionReactor.java b/src/main/java/gregtech/common/gui/GT_GUIContainer_FusionReactor.java index bb806b177f..b6a86fd668 100644 --- a/src/main/java/gregtech/common/gui/GT_GUIContainer_FusionReactor.java +++ b/src/main/java/gregtech/common/gui/GT_GUIContainer_FusionReactor.java @@ -1,6 +1,5 @@ package gregtech.common.gui; -import gregtech.api.enums.GuiColors; import gregtech.api.gui.GT_Container_MultiMachine; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -16,7 +15,11 @@ public class GT_GUIContainer_FusionReactor extends GT_GUIContainerMetaTile_Machi public String mNEI; String mName = ""; - private final int textColor = GuiColors.fusionReactor.getColor(); + + private final int + textColor = this.getTextColorOrDefault("text", 0xFAFAFF), + textColorTitle = this.getTextColorOrDefault("title", 0xFAFAFF), + textColorValue = this.getTextColorOrDefault("value", 0xFF0000); public GT_GUIContainer_FusionReactor(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile, String aNEI) { super(new GT_Container_MultiMachine(aInventoryPlayer, aTileEntity, false), RES_PATH_GUI + "multimachines/" + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); @@ -26,29 +29,29 @@ public class GT_GUIContainer_FusionReactor extends GT_GUIContainerMetaTile_Machi @Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { - fontRendererObj.drawString(mName, 8, -10, 16448255); + fontRendererObj.drawString(mName, 8, -10, textColorTitle); if (mContainer != null) { if ((mContainer.mDisplayErrorCode & 64) != 0) - fontRendererObj.drawString("Incomplete Structure.", 10, 8, 16448255); + fontRendererObj.drawString("Incomplete Structure.", 10, 8, textColor); if (mContainer.mDisplayErrorCode == 0) { if (mContainer.mActive == 0) { - fontRendererObj.drawString("Hit with Soft Mallet to (re-)start the Machine if it doesn't start.", -70, 170, 16448255); + fontRendererObj.drawString("Hit with Soft Mallet to (re-)start the Machine if it doesn't start.", -70, 170, textColor); } else { - fontRendererObj.drawString("Running perfectly.", 10, 170, 16448255); + fontRendererObj.drawString("Running perfectly.", 10, 170, textColor); } } if(this.mContainer.mEnergy > 160000000 && this.mContainer.mEnergy < 160010000) - fontRendererObj.drawString("160,000,000 EU", 50, 155, textColor); + fontRendererObj.drawString("160,000,000 EU", 50, 155, textColorValue); else if(this.mContainer.mEnergy > 320000000 && this.mContainer.mEnergy < 320010000) - fontRendererObj.drawString("320,000,000 EU", 50, 155, textColor); + fontRendererObj.drawString("320,000,000 EU", 50, 155, textColorValue); else if(this.mContainer.mEnergy > 640000000 && this.mContainer.mEnergy < 640010000) - fontRendererObj.drawString("640,000,000 EU", 50, 155, textColor); + fontRendererObj.drawString("640,000,000 EU", 50, 155, textColorValue); else if(this.mContainer.mEnergyLong > 5120000000L && this.mContainer.mEnergyLong < 5120080000L) - fontRendererObj.drawString("5,120,000,000 EU", 50, 155, textColor); + fontRendererObj.drawString("5,120,000,000 EU", 50, 155, textColorValue); else - fontRendererObj.drawString(GT_Utility.formatNumbers(this.mContainer.mEnergyLong) + " EU", 50, 155, textColor); + fontRendererObj.drawString(GT_Utility.formatNumbers(this.mContainer.mEnergyLong) + " EU", 50, 155, textColorValue); } } diff --git a/src/main/java/gregtech/common/gui/GT_GUIContainer_IndustrialApiary.java b/src/main/java/gregtech/common/gui/GT_GUIContainer_IndustrialApiary.java index 18909b7013..9b0de5ba81 100644 --- a/src/main/java/gregtech/common/gui/GT_GUIContainer_IndustrialApiary.java +++ b/src/main/java/gregtech/common/gui/GT_GUIContainer_IndustrialApiary.java @@ -2,7 +2,6 @@ package gregtech.common.gui; import forestry.api.apiculture.*; import gregtech.api.enums.GT_Values; -import gregtech.api.enums.GuiColors; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.gui.widgets.GT_GuiSlotTooltip; import gregtech.api.gui.widgets.GT_GuiTooltip; @@ -19,7 +18,6 @@ import java.util.Arrays; public class GT_GUIContainer_IndustrialApiary extends GT_GUIContainerMetaTile_Machine { - private static final String BATTERY_SLOT_TOOLTIP = "GT5U.machines.battery_slot.tooltip", UNUSED_SLOT_TOOLTIP = "GT5U.machines.unused_slot.tooltip", @@ -32,9 +30,12 @@ public class GT_GUIContainer_IndustrialApiary extends GT_GUIContainerMetaTile_Ma INFO_TOOLTIP = "GT5U.machines.industrialapiary.info.tooltip", INFO_WITH_BEE_TOOLTIP = "GT5U.machines.industrialapiary.infoextended.tooltip", UPGRADE_TOOLTIP = "GT5U.machines.industrialapiary.upgradeslot.tooltip" - ; + ; - private final int textColor = GuiColors.industrialApiary.getColor(); + private final int + textColor = this.getTextColorOrDefault("text", 0x404040), + textColorTitle = this.getTextColorOrDefault("title", 0x404040), + textColorValue = this.getTextColorOrDefault("value", 0x404040); GT_GuiTooltip mErrorStatesTooltip; GT_GuiTooltip mSpeedToggleTooltip; @@ -117,9 +118,9 @@ public class GT_GUIContainer_IndustrialApiary extends GT_GUIContainerMetaTile_Ma @Override protected void drawGuiContainerForegroundLayer(int par1, int par2) { - this.fontRendererObj.drawString("Ind. Apiary", 8, 4, textColor); + this.fontRendererObj.drawString("Ind. Apiary", 8, 4, textColorTitle); this.fontRendererObj.drawString("x", 30, 63, textColor); - this.fontRendererObj.drawString((1 << getContainer().mSpeed) + "", 26, 72, textColor); + this.fontRendererObj.drawString((1 << getContainer().mSpeed) + "", 26, 72, textColorValue); } @Override diff --git a/src/main/java/gregtech/common/gui/GT_GUIContainer_MicrowaveEnergyTransmitter.java b/src/main/java/gregtech/common/gui/GT_GUIContainer_MicrowaveEnergyTransmitter.java index d75ea5c9ec..9421441f22 100644 --- a/src/main/java/gregtech/common/gui/GT_GUIContainer_MicrowaveEnergyTransmitter.java +++ b/src/main/java/gregtech/common/gui/GT_GUIContainer_MicrowaveEnergyTransmitter.java @@ -1,6 +1,5 @@ package gregtech.common.gui; -import gregtech.api.enums.GuiColors; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Utility; @@ -10,7 +9,9 @@ import static gregtech.api.enums.GT_Values.RES_PATH_GUI; public class GT_GUIContainer_MicrowaveEnergyTransmitter extends GT_GUIContainerMetaTile_Machine { - private final int textColor = GuiColors.microwaveEnergyTransmitter.getColor(); + private final int + textColor = this.getTextColorOrDefault("text", 0xFAFAFF), + textColorTitle = this.getTextColorOrDefault("title", 0xFAFAFF); public GT_GUIContainer_MicrowaveEnergyTransmitter(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { super(new GT_Container_MicrowaveEnergyTransmitter(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "Teleporter.png"); @@ -18,7 +19,7 @@ public class GT_GUIContainer_MicrowaveEnergyTransmitter extends GT_GUIContainerM @Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { - this.fontRendererObj.drawString("Teleporter", 46, 8, 16448255); + this.fontRendererObj.drawString("Teleporter", 46, 8, textColorTitle); if (this.mContainer != null) { this.fontRendererObj.drawString("X: " + GT_Utility.parseNumberToString(((GT_Container_MicrowaveEnergyTransmitter) this.mContainer).mTargetX), 46, 16, textColor); this.fontRendererObj.drawString("Y: " + GT_Utility.parseNumberToString(((GT_Container_MicrowaveEnergyTransmitter) this.mContainer).mTargetY), 46, 24, textColor); diff --git a/src/main/java/gregtech/common/gui/GT_GUIContainer_OutputHatch.java b/src/main/java/gregtech/common/gui/GT_GUIContainer_OutputHatch.java index 33bac13be6..789e11e6f1 100644 --- a/src/main/java/gregtech/common/gui/GT_GUIContainer_OutputHatch.java +++ b/src/main/java/gregtech/common/gui/GT_GUIContainer_OutputHatch.java @@ -5,7 +5,6 @@ import codechicken.nei.api.INEIGuiHandler; import codechicken.nei.api.TaggedInventoryArea; import cpw.mods.fml.common.Optional; import gregtech.api.enums.GT_Values; -import gregtech.api.enums.GuiColors; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.net.GT_Packet_SetLockedFluid; @@ -26,12 +25,9 @@ public class GT_GUIContainer_OutputHatch extends GT_GUIContainerMetaTile_Machine private final String mName; private final int - textColorTitle = GuiColors.outputHatchTitle.getColor(), - textColorInventory = GuiColors.outputHatchInventory.getColor(), - textColorAmount = GuiColors.outputHatchAmount.getColor(), - textColorAmountValue = GuiColors.outputHatchValue.getColor(), - textColorFluidName = GuiColors.outputHatchFluidName.getColor(), - textColorLockedFluid = GuiColors.outputHatchLockedFluid.getColor(); + textColor = this.getTextColorOrDefault("text", 0xFAFAFF), + textColorTitle = this.getTextColorOrDefault("title", 0x404040), + textColorValue = this.getTextColorOrDefault("value", 0xFAFAFF); public GT_GUIContainer_OutputHatch(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) { super(new GT_Container_OutputHatch(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "OutputHatch.png"); @@ -40,15 +36,15 @@ public class GT_GUIContainer_OutputHatch extends GT_GUIContainerMetaTile_Machine @Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { - fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 2, textColorInventory); + fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 2, textColorTitle); fontRendererObj.drawString(mName, 8, 6, textColorTitle); if (mContainer != null) { - fontRendererObj.drawString("Liquid Amount", 10, 20, textColorAmount); - fontRendererObj.drawString(GT_Utility.parseNumberToString(((GT_Container_OutputHatch) mContainer).mContent), 10, 30, textColorAmountValue); - fontRendererObj.drawString("Locked Fluid", 101, 20, textColorAmount); + fontRendererObj.drawString("Liquid Amount", 10, 20, textColor); + fontRendererObj.drawString(GT_Utility.parseNumberToString(((GT_Container_OutputHatch) mContainer).mContent), 10, 30, textColorValue); + fontRendererObj.drawString("Locked Fluid", 101, 20, textColor); ItemStack tLockedDisplayStack = (ItemStack) mContainer.getInventory().get(3); String fluidName = tLockedDisplayStack == null ? "None" : tLockedDisplayStack.getDisplayName(); - fontRendererObj.drawString(fluidName, 101, 30, textColorFluidName); + fontRendererObj.drawString(fluidName, 101, 30, textColorValue); } } diff --git a/src/main/java/gregtech/common/gui/GT_GUIContainer_PrimitiveBlastFurnace.java b/src/main/java/gregtech/common/gui/GT_GUIContainer_PrimitiveBlastFurnace.java index dfd1e61aa9..eff12be29a 100644 --- a/src/main/java/gregtech/common/gui/GT_GUIContainer_PrimitiveBlastFurnace.java +++ b/src/main/java/gregtech/common/gui/GT_GUIContainer_PrimitiveBlastFurnace.java @@ -1,6 +1,5 @@ package gregtech.common.gui; -import gregtech.api.enums.GuiColors; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.gui.widgets.GT_GuiIcon; import gregtech.api.gui.widgets.GT_GuiTabLine.GT_GuiTabIconSet; @@ -18,7 +17,7 @@ public class GT_GUIContainer_PrimitiveBlastFurnace extends GT_GUIContainerMetaTi GT_GuiIcon.TAB_NORMAL_BRICK, GT_GuiIcon.TAB_HIGHLIGHT_BRICK, GT_GuiIcon.TAB_DISABLED_BRICK); - private final int textColor = GuiColors.primitiveBlastFurnace.getColor(); + private final int textColor = this.getTextColorOrDefault("title", 0x404040); public GT_GUIContainer_PrimitiveBlastFurnace(InventoryPlayer inventoryPlayer, IGregTechTileEntity tileEntity, String name, String aNEI) { diff --git a/src/main/java/gregtech/common/gui/GT_GUIContainer_QuantumChest.java b/src/main/java/gregtech/common/gui/GT_GUIContainer_QuantumChest.java index 370c71fed9..51086d3cfd 100644 --- a/src/main/java/gregtech/common/gui/GT_GUIContainer_QuantumChest.java +++ b/src/main/java/gregtech/common/gui/GT_GUIContainer_QuantumChest.java @@ -1,6 +1,5 @@ package gregtech.common.gui; -import gregtech.api.enums.GuiColors; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Utility; @@ -12,9 +11,10 @@ import static gregtech.api.enums.GT_Values.RES_PATH_GUI; public class GT_GUIContainer_QuantumChest extends GT_GUIContainerMetaTile_Machine { private final String mName; - private final int - textColorTitle = GuiColors.quantumChestTitle.getColor(), - textColorAmount = GuiColors.quantumChestAmount.getColor(); + private final int + textColor = this.getTextColorOrDefault("text", 0xFAFAFF), + textColorTitle = this.getTextColorOrDefault("title", 0x404040), + textColorValue = this.getTextColorOrDefault("value", 0xFAFAFF); public GT_GUIContainer_QuantumChest(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) { @@ -27,8 +27,8 @@ public class GT_GUIContainer_QuantumChest extends GT_GUIContainerMetaTile_Machin fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 2, textColorTitle); fontRendererObj.drawString(mName, 8, 6, textColorTitle); if (mContainer != null) { - fontRendererObj.drawString("Item Amount", 10, 20, textColorAmount); - fontRendererObj.drawString(GT_Utility.parseNumberToString(((GT_Container_QuantumChest) mContainer).mContent), 10, 30, textColorAmount); + fontRendererObj.drawString("Item Amount", 10, 20, textColor); + fontRendererObj.drawString(GT_Utility.parseNumberToString(((GT_Container_QuantumChest) mContainer).mContent), 10, 30, textColorValue); } } diff --git a/src/main/java/gregtech/common/gui/GT_GUIContainer_Regulator.java b/src/main/java/gregtech/common/gui/GT_GUIContainer_Regulator.java index 09fb48121e..6a02fc8bca 100644 --- a/src/main/java/gregtech/common/gui/GT_GUIContainer_Regulator.java +++ b/src/main/java/gregtech/common/gui/GT_GUIContainer_Regulator.java @@ -1,13 +1,12 @@ package gregtech.common.gui; -import gregtech.api.enums.GuiColors; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; public class GT_GUIContainer_Regulator extends GT_GUIContainerMetaTile_Machine { - private final int textColor = GuiColors.regulator.getColor(); + private final int textColor = this.getTextColorOrDefault("text", 0xFAFAFF); public GT_GUIContainer_Regulator(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { super(new GT_Container_Regulator(aInventoryPlayer, aTileEntity), "gregtech:textures/gui/Regulator.png"); diff --git a/src/main/java/gregtech/common/gui/GT_GUIContainer_Teleporter.java b/src/main/java/gregtech/common/gui/GT_GUIContainer_Teleporter.java index efc4771b22..3d6aa6f966 100644 --- a/src/main/java/gregtech/common/gui/GT_GUIContainer_Teleporter.java +++ b/src/main/java/gregtech/common/gui/GT_GUIContainer_Teleporter.java @@ -1,6 +1,5 @@ package gregtech.common.gui; -import gregtech.api.enums.GuiColors; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Utility; @@ -10,7 +9,9 @@ import static gregtech.api.enums.GT_Values.RES_PATH_GUI; public class GT_GUIContainer_Teleporter extends GT_GUIContainerMetaTile_Machine { - private final int textColor = GuiColors.teleporter.getColor(); + private final int + textColor = this.getTextColorOrDefault("text", 0xFAFAFF), + textColorTitle = this.getTextColorOrDefault("text", 0xFAFAFF); public GT_GUIContainer_Teleporter(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { super(new GT_Container_Teleporter(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "Teleporter.png"); @@ -18,7 +19,7 @@ public class GT_GUIContainer_Teleporter extends GT_GUIContainerMetaTile_Machine @Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { - this.fontRendererObj.drawString("Teleporter", 46, 8, 16448255); + this.fontRendererObj.drawString("Teleporter", 46, 8, textColorTitle); if (this.mContainer != null) { this.fontRendererObj.drawString("X: " + GT_Utility.parseNumberToString(((GT_Container_Teleporter) this.mContainer).mTargetX), 46, 16, textColor); this.fontRendererObj.drawString("Y: " + GT_Utility.parseNumberToString(((GT_Container_Teleporter) this.mContainer).mTargetY), 46, 24, textColor); diff --git a/src/main/java/gregtech/common/render/GT_FluidDisplayStackRenderer.java b/src/main/java/gregtech/common/render/GT_FluidDisplayStackRenderer.java index 76a475a1a5..c4e23eab6e 100644 --- a/src/main/java/gregtech/common/render/GT_FluidDisplayStackRenderer.java +++ b/src/main/java/gregtech/common/render/GT_FluidDisplayStackRenderer.java @@ -1,7 +1,6 @@ package gregtech.common.render; import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.GuiColors; import gregtech.api.enums.ItemList; import gregtech.common.items.GT_FluidDisplayItem; import net.minecraft.client.Minecraft; @@ -17,8 +16,6 @@ import org.lwjgl.opengl.GL11; @SideOnly(cpw.mods.fml.relauncher.Side.CLIENT) public class GT_FluidDisplayStackRenderer implements IItemRenderer { - private final GuiColors textColor = GuiColors.fluidDisplayStackRenderer; - public GT_FluidDisplayStackRenderer() { MinecraftForgeClient.registerItemRenderer(ItemList.Display_Fluid.getItem(), this); } @@ -92,7 +89,7 @@ public class GT_FluidDisplayStackRenderer implements IItemRenderer { GL11.glDisable(GL11.GL_BLEND); GL11.glScalef(smallTextScale, smallTextScale, 1.0f); - fontRender.drawString( amountString, 0, (int) (16/smallTextScale) - fontRender.FONT_HEIGHT + 1, textColor.getColor(), true); + fontRender.drawString( amountString, 0, (int) (16/smallTextScale) - fontRender.FONT_HEIGHT + 1, 0xFFFFFF, true); GL11.glScalef(1f, 1f, 1f); GL11.glDisable(GL11.GL_ALPHA_TEST); } diff --git a/src/main/java/gregtech/common/render/GT_PollutionRenderer.java b/src/main/java/gregtech/common/render/GT_PollutionRenderer.java index e385bd7686..5128af1c36 100644 --- a/src/main/java/gregtech/common/render/GT_PollutionRenderer.java +++ b/src/main/java/gregtech/common/render/GT_PollutionRenderer.java @@ -7,7 +7,6 @@ import cpw.mods.fml.common.gameevent.TickEvent; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.GT_Mod; -import gregtech.api.enums.GuiColors; import gregtech.common.entities.GT_EntityFXPollution; import gregtech.common.misc.GT_ClientPollutionMap; import net.minecraft.block.Block; @@ -47,8 +46,6 @@ public class GT_PollutionRenderer { private static final short[] liquidColor = {160, 200, 10}; private static final short[] foliageColor = {160, 80, 15}; - private final GuiColors textColor = GuiColors.pollutionRenderer; - //TODO need to soft update some blocks, grass and leaves does more often than liquid it looks like. public GT_PollutionRenderer() { @@ -248,7 +245,7 @@ public class GT_PollutionRenderer { GL11.glPushMatrix(); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); - Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(text, 0, off, textColor.getColor()); + Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(text, 0, off, 0xFFFFFFFF); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); } diff --git a/src/main/java/gregtech/loaders/misc/GT_JsonLoader.java b/src/main/java/gregtech/loaders/misc/GT_JsonLoader.java deleted file mode 100644 index aaa36389ad..0000000000 --- a/src/main/java/gregtech/loaders/misc/GT_JsonLoader.java +++ /dev/null @@ -1,72 +0,0 @@ -package gregtech.loaders.misc; - -import com.google.gson.Gson; -import com.google.gson.JsonObject; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.io.Reader; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.List; -import java.util.function.Consumer; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.IReloadableResourceManager; -import net.minecraft.client.resources.IResourceManager; -import net.minecraft.client.resources.IResourceManagerReloadListener; -import net.minecraft.util.ResourceLocation; - -import static gregtech.GT_Mod.GT_FML_LOGGER; - -@SideOnly(Side.CLIENT) -public class GT_JsonLoader implements IResourceManagerReloadListener { - private static final Gson gson = new Gson(); - private JsonObject json; - private final ResourceLocation jsonLocation; - private final List<Consumer<GT_JsonLoader>> reloadListeners; - - public String getString(String key) { - String s = ""; - try { - s = this.json.get(key).getAsString(); - } catch (Exception e) { - // stupid log4j - GT_FML_LOGGER.error("GT_JsonLoader " + jsonLocation + " read error", e); - } - return s; - } - - private void loadJson(IResourceManager rm) { - this.json = new JsonObject(); - try (Reader in = new BufferedReader(new InputStreamReader(rm.getResource(this.jsonLocation).getInputStream(), StandardCharsets.UTF_8))) { - json = gson.fromJson(in, JsonObject.class); - } catch (Exception e) { - // stupid log4j - GT_FML_LOGGER.error("GT_JsonLoader " + jsonLocation + " load error", e); - } - } - - @Override - public void onResourceManagerReload(IResourceManager rm) { - loadJson(rm); - for (Consumer<GT_JsonLoader> listener : reloadListeners) { - listener.accept(this); - } - } - - public void registerReloadListener(Consumer<GT_JsonLoader> listener) { - reloadListeners.add(listener); - } - - public GT_JsonLoader(String resourcePath) { - GT_FML_LOGGER.info("GT_JsonLoader: Init"); - this.jsonLocation = new ResourceLocation("gregtech", resourcePath); - reloadListeners = new ArrayList<>(); - IReloadableResourceManager rm = (IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager(); - rm.registerReloadListener(this); - loadJson(rm); - } -} diff --git a/src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java b/src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java index 35da96918f..3fdefd07d9 100644 --- a/src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java +++ b/src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java @@ -12,7 +12,6 @@ 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; @@ -23,14 +22,17 @@ import gregtech.api.util.GT_Recipe.GT_Recipe_WithAlt; import gregtech.api.util.GT_Utility; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.resources.IResource; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidStack; import org.lwjgl.opengl.GL11; import java.awt.*; +import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; @@ -47,7 +49,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 GuiColors textColor = GuiColors.NEIText; + private String mRecipeName; static { GuiContainerManager.addInputHandler(new GT_RectHandler()); @@ -65,10 +67,6 @@ public class GT_NEI_AssLineHandler extends RecipeMapHandler { return result; } - public static void drawText(int aX, int aY, String aString, int aColor) { - Minecraft.getMinecraft().fontRenderer.drawString(aString, aX, aY, aColor); - } - @Override public TemplateRecipeHandler newInstance() { NEI_GT_Config.ALH=new GT_NEI_AssLineHandler(this.mRecipeMap); @@ -201,7 +199,11 @@ public class GT_NEI_AssLineHandler extends RecipeMapHandler { @Override public String getRecipeName() { - return GT_LanguageManager.getTranslation(this.mRecipeMap.mUnlocalizedName); + if (mRecipeName == null) { + mRecipeName = GT_LanguageManager.getTranslation(this.mRecipeMap.mUnlocalizedName); + updateOverrideTextColor(); + } + return mRecipeName; } @Override @@ -245,66 +247,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", textColor.getColor()); - drawText(10, 83, trans("153","Usage: ") + GT_Utility.formatNumbers(tEUt) + " EU/t", textColor.getColor()); + 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); 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", textColor.getColor()); + drawText(10, 93, trans("154", "Voltage: ") + GT_Utility.formatNumbers(voltage) + " EU", 0xFF000000); } else { - drawText(10, 93, trans("154","Voltage: ") + GT_Utility.formatNumbers(voltage) + " EU (" + GT_Values.VN[tier] + ")", textColor.getColor()); + drawText(10, 93, trans("154","Voltage: ") + GT_Utility.formatNumbers(voltage) + " EU (" + GT_Values.VN[tier] + ")", 0xFF000000); } - drawText(10, 103, trans("155","Amperage: ") + GT_Utility.formatNumbers(this.mRecipeMap.mAmperage), textColor.getColor()); + drawText(10, 103, trans("155","Amperage: ") + GT_Utility.formatNumbers(this.mRecipeMap.mAmperage), 0xFF000000); } else { - drawText(10, 93, trans("156","Voltage: unspecified"), textColor.getColor()); - drawText(10, 103, trans("157","Amperage: unspecified"), textColor.getColor()); + drawText(10, 93, trans("156","Voltage: unspecified"), 0xFF000000); + drawText(10, 103, trans("157","Amperage: unspecified"), 0xFF000000); } } if (tDuration > 0) { - drawText(10, 113, trans("158","Time: ") + GT_Utility.formatNumbers(0.05d * tDuration) + trans("161"," secs"), textColor.getColor()); + drawText(10, 113, trans("158","Time: ") + GT_Utility.formatNumbers(0.05d * tDuration) + trans("161"," secs"), 0xFF000000); } 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"), textColor.getColor()); + drawText(10, 123, trans("159","Needs Low Gravity"), 0xFF000000); specialDrew = true; } else if (tSpecial == -200 && GT_Mod.gregtechproxy.mEnableCleanroom) { - drawText(10, 123, trans("160","Needs Cleanroom"), textColor.getColor()); + drawText(10, 123, trans("160","Needs Cleanroom"), 0xFF000000); specialDrew = true; } else if (tSpecial == -201) { - drawText(10, 123, trans("206","Scan for Assembly Line"), textColor.getColor()); + drawText(10, 123, trans("206","Scan for Assembly Line"), 0xFF000000); 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, textColor.getColor()); + drawText(10, 123, this.mRecipeMap.mNEISpecialValuePre + GT_Utility.formatNumbers(tSpecial * this.mRecipeMap.mNEISpecialValueMultiplier) + this.mRecipeMap.mNEISpecialValuePost, 0xFF000000); 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(), textColor.getColor()); + drawText(10, y, EnumChatFormatting.ITALIC + GT_Utility.trans("226", "Original Recipe by: ") + recipe.owners.get(0).getName(), 0xFF000000); 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(), textColor.getColor()); + drawText(10, y, EnumChatFormatting.ITALIC + GT_Utility.trans("227", "Modified by: ") + recipe.owners.get(i).getName(), 0xFF000000); y += 10; } } else if (recipe.owners.size() > 0) { - drawText(10, y, EnumChatFormatting.ITALIC + GT_Utility.trans("225", "Recipe by: ") + recipe.owners.get(0).getName(), textColor.getColor()); + drawText(10, y, EnumChatFormatting.ITALIC + GT_Utility.trans("225", "Recipe by: ") + recipe.owners.get(0).getName(), 0xFF000000); y += 10; } } if (GT_Mod.gregtechproxy.mNEIRecipeOwnerStackTrace && recipe.stackTraces != null && !recipe.stackTraces.isEmpty()) { - drawText(10, y, "stackTrace:", textColor.getColor()); + drawText(10, y, "stackTrace:", 0xFF000000); y += 10; for (StackTraceElement stackTrace : recipe.stackTraces.get(0)) { - drawText(10, y, stackTrace.toString(), textColor.getColor()); + drawText(10, y, stackTrace.toString(), 0xFF000000); y += 10; } } } else { int i = 0; for (String descLine : recipeDesc) { - drawText(10, 73 + 10 * i, descLine, textColor.getColor()); + drawText(10, 73 + 10 * i, descLine, 0xFF000000); i++; } } diff --git a/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java b/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java index bda4ac8c31..eeea2374ba 100644 --- a/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java +++ b/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java @@ -15,7 +15,6 @@ 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; @@ -33,9 +32,11 @@ import gregtech.common.power.UnspecifiedEUPower; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.resources.IResource; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.FluidStack; import org.apache.commons.lang3.Range; import org.lwjgl.opengl.GL11; @@ -43,6 +44,7 @@ import org.lwjgl.opengl.GL11; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.awt.*; +import java.io.IOException; import java.lang.ref.SoftReference; import java.util.ArrayList; import java.util.Collections; @@ -69,7 +71,6 @@ 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 GuiColors textColor = GuiColors.NEIText; /** * Static version of {@link TemplateRecipeHandler#cycleticks}. @@ -121,10 +122,6 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler { return cache; } - public static void drawText(int aX, int aY, String aString, int aColor) { - Minecraft.getMinecraft().fontRenderer.drawString(aString, aX, aY, aColor); - } - @Override public TemplateRecipeHandler newInstance() { return new GT_NEI_DefaultHandler(this.mRecipeMap); @@ -262,6 +259,7 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler { public String getRecipeName() { if (mRecipeName == null) { mRecipeName = computeRecipeName(); + updateOverrideTextColor(); } return mRecipeName; } @@ -524,7 +522,7 @@ public class GT_NEI_DefaultHandler extends RecipeMapHandler { } protected void drawLine(int lineNumber, String line) { - drawText(10, getDescriptionYOffset() + lineNumber * 10, line, textColor.getColor()); + drawText(10, getDescriptionYOffset() + lineNumber * 10, line, 0xFF000000); } protected int getDescriptionYOffset() { diff --git a/src/main/java/gregtech/nei/RecipeMapHandler.java b/src/main/java/gregtech/nei/RecipeMapHandler.java index aac322d303..954f7ae7ba 100644 --- a/src/main/java/gregtech/nei/RecipeMapHandler.java +++ b/src/main/java/gregtech/nei/RecipeMapHandler.java @@ -1,7 +1,9 @@ package gregtech.nei; import codechicken.nei.recipe.TemplateRecipeHandler; +import gregtech.api.gui.GT_GUIColorOverride; import gregtech.api.util.GT_Recipe; +import net.minecraft.client.Minecraft; /** * This abstract class represents an NEI handler that is constructed from a @@ -10,6 +12,9 @@ import gregtech.api.util.GT_Recipe; abstract class RecipeMapHandler extends TemplateRecipeHandler { protected final GT_Recipe.GT_Recipe_Map mRecipeMap; + private GT_GUIColorOverride colorOverride; + private int overrideTextColor = -1; + RecipeMapHandler(GT_Recipe.GT_Recipe_Map mRecipeMap) { this.mRecipeMap = mRecipeMap; } @@ -17,4 +22,13 @@ abstract class RecipeMapHandler extends TemplateRecipeHandler { GT_Recipe.GT_Recipe_Map getRecipeMap() { return mRecipeMap; } + + protected void updateOverrideTextColor() { + colorOverride = new GT_GUIColorOverride(mRecipeMap.mNEIGUIPath); + overrideTextColor = colorOverride.getTextColorOrDefault("nei", -1); + } + + protected void drawText(int aX, int aY, String aString, int aColor) { + Minecraft.getMinecraft().fontRenderer.drawString(aString, aX, aY, overrideTextColor != -1 ? overrideTextColor : aColor); + } } |