diff options
author | Albi <12825442+Flanisch@users.noreply.github.com> | 2022-08-15 21:27:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-15 21:27:24 +0200 |
commit | 43c014a8db9ad4d44c19190718835a7596dc0a2d (patch) | |
tree | 173ca882874af36bde55889ae585dc9111825184 /src/main/java/gregtech/common/gui | |
parent | ed8fb594433346dfd37235c0604851436e0980df (diff) | |
download | GT5-Unofficial-43c014a8db9ad4d44c19190718835a7596dc0a2d.tar.gz GT5-Unofficial-43c014a8db9ad4d44c19190718835a7596dc0a2d.tar.bz2 GT5-Unofficial-43c014a8db9ad4d44c19190718835a7596dc0a2d.zip |
Overriding GUI colors with .mcmeta (#1261)
* Implemented gui textcolor override with .mcmeta files
* cleanup
* Added shared class to reduce code duplication
* Moved #drawLine back to GT_NEI_DefaultHandler
Diffstat (limited to 'src/main/java/gregtech/common/gui')
10 files changed, 47 insertions, 49 deletions
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); |