diff options
| author | miozune <miozune@gmail.com> | 2023-01-05 23:56:45 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-05 15:56:45 +0100 |
| commit | 7015c5b2eb5b081e1a477cf430a8173b2de6d206 (patch) | |
| tree | 67ac6eecbf4292e1e1a43aadcc69e052e227d4a3 | |
| parent | ae916ac62a0a75749cfc4a1974d5fb40b6dc7ddf (diff) | |
| download | GT5-Unofficial-7015c5b2eb5b081e1a477cf430a8173b2de6d206.tar.gz GT5-Unofficial-7015c5b2eb5b081e1a477cf430a8173b2de6d206.tar.bz2 GT5-Unofficial-7015c5b2eb5b081e1a477cf430a8173b2de6d206.zip | |
Allow overriding more progressbar textures & Add document for resource packs (#1632)
6 files changed, 134 insertions, 22 deletions
diff --git a/ResourcePacks_Guide.md b/ResourcePacks_Guide.md new file mode 100644 index 0000000000..5b3dabbcd1 --- /dev/null +++ b/ResourcePacks_Guide.md @@ -0,0 +1,67 @@ +This is a guide for resource packs to set up advanced configurations for GUI. + +## Override text color with mcmeta files + +You might want to change color of text if your texture has similar color to text. You can place mcmeta files at the following locations: +- `gregtech/textures/gui/background/singleblock_default.mcmeta` (most of the machines) +- `gregtech/textures/gui/background/bronze.mcmeta` (steam bronze machines) +- `gregtech/textures/gui/background/steel.mcmeta` (steam steel machines) +- `gregtech/textures/gui/background/primitive.mcmeta` (steam primitive machines) +- `gregtech/textures/gui/background/fusion_computer.mcmeta` (fusion reactor controller) +- `modularui/textures/gui/background/vanilla_background.mcmeta` (NEI) + +(and there might be more in the future, but currently these are exhaustive.) + +Here is an example of the file: +```json +{ + "colors": { + "guiTint": { + "enableGUITint": true, + "Black": "202020", + "Red": "800000", + "Green": "005B00", + "Brown": "553C00", + "Blue": "002456", + "Purple": "551839", + "Cyan": "007780", + "Light Gray": "AAAAAA", + "Gray": "808080", + "Pink": "800056", + "Lime": "559155", + "Yellow": "AAA455", + "Light Blue": "55A4AA", + "Magenta": "BF4095", + "Orange": "AA4F00", + "White": "FAFAFF", + "Machine Metal": "0047AB" + }, + "textColor": { + "title": "FF7700", + "title_white": "66FAFA", + "text_white": "807BAA", + "text_gray": "AAE055", + "text_red": "FF2222", + "nei": "556D8E", + "nei_overlay_yellow": "0xFDD835" + } + } +} +``` + +## Override progress bar texture + +With the transition to ModularUI, many of the textures can be reused in many places now. However, some resource packs still want to add progress bar textures for singleblock machines, unique to each type of them. +You can simply add textures named by the following rules: + +- Basically place at `gregtech/textures/gui/progressbar/${unlocalized name of recipemap}`. Unlocalized name can be found on either of: + - Hold shift while hovering over NEI tab. "HandlerID" indicates unlocalized name. + + - Read code. Usually they're passed as 2nd argument for `GT_Recipe_Map` constructor. Recipemaps are defined at `gregtech.api.util.GT_Recipe`. +- For steam machines, append `_bronze`, `_steel`, or `_primitive`. +- Exceptions: Miner: `miner`, Electric Furnace: `E_Furnace`, Electric Oven: `E_Oven` + +Examples: +- `gregtech/textures/gui/progressbar/gt.recipe.laserengraver.png` +- `gregtech/textures/gui/progressbar/gt.recipe.alloysmelter_bronze.png` +- `gregtech/textures/gui/progressbar/E_Furnace.png` diff --git a/screenshots/recipemap-unlocalized-name.png b/screenshots/recipemap-unlocalized-name.png Binary files differnew file mode 100644 index 0000000000..31c2b8bec9 --- /dev/null +++ b/screenshots/recipemap-unlocalized-name.png diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java index 83e124aad8..75b055324a 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java @@ -6,6 +6,11 @@ import static gregtech.api.enums.GT_Values.W; import static gregtech.api.enums.GT_Values.ticksBetweenSounds; import static gregtech.api.objects.XSTR.XSTR_INSTANCE; +import com.gtnewhorizons.modularui.api.drawable.FallbackableUITexture; +import com.gtnewhorizons.modularui.api.drawable.UITexture; +import com.gtnewhorizons.modularui.api.math.Pos2d; +import com.gtnewhorizons.modularui.api.math.Size; +import com.gtnewhorizons.modularui.common.widget.ProgressBar; import cpw.mods.fml.common.Loader; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -14,6 +19,7 @@ import gregtech.api.enums.ParticleFX; import gregtech.api.enums.Textures.BlockIcons.CustomIcon; import gregtech.api.gui.GT_Container_BasicMachine; import gregtech.api.gui.GT_GUIContainer_BasicMachine; +import gregtech.api.gui.modularui.GT_UITextures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -48,6 +54,7 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ private final ResourceLocation mSoundResourceLocation; private final boolean mSharedTank, mRequiresFluidForFiltering; private final byte mGUIParameterA, mGUIParameterB; + private FallbackableUITexture progressBarTexture; public GT_MetaTileEntity_BasicMachine_GT_Recipe( int aID, @@ -151,6 +158,7 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ this.mSoundResourceLocation = aSound; this.mGUIParameterA = (byte) aGUIParameterA; this.mGUIParameterB = (byte) aGUIParameterB; + this.progressBarTexture = mRecipes.getProgressBarTextureRaw(); // TODO: CHECK if (aRecipe != null) { @@ -1043,23 +1051,38 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_BasicMachine_GT_Recipe( - this.mName, - this.mTier, - this.mDescriptionArray, - this.mRecipes, - this.mInputSlotCount, - this.mOutputItems == null ? 0 : this.mOutputItems.length, - this.mTankCapacity, - this.mAmperage, - this.mGUIParameterA, - this.mGUIParameterB, - this.mTextures, - this.mGUIName, - this.mNEIName, - this.mSoundResourceLocation.toString(), - this.mSharedTank, - this.mRequiresFluidForFiltering, - this.mSpecialEffect.ordinal()); + this.mName, + this.mTier, + this.mDescriptionArray, + this.mRecipes, + this.mInputSlotCount, + this.mOutputItems == null ? 0 : this.mOutputItems.length, + this.mTankCapacity, + this.mAmperage, + this.mGUIParameterA, + this.mGUIParameterB, + this.mTextures, + this.mGUIName, + this.mNEIName, + this.mSoundResourceLocation.toString(), + this.mSharedTank, + this.mRequiresFluidForFiltering, + this.mSpecialEffect.ordinal()) + .setProgressBarTexture(this.progressBarTexture); + } + + public GT_MetaTileEntity_BasicMachine_GT_Recipe setProgressBarTexture(FallbackableUITexture progressBarTexture) { + this.progressBarTexture = progressBarTexture; + return this; + } + + public GT_MetaTileEntity_BasicMachine_GT_Recipe setProgressBarTextureName(String name, UITexture fallback) { + return setProgressBarTexture( + new FallbackableUITexture(UITexture.fullImage("gregtech", "gui/progressbar/" + name), fallback)); + } + + public GT_MetaTileEntity_BasicMachine_GT_Recipe setProgressBarTextureName(String name) { + return setProgressBarTextureName(name, GT_UITextures.PROGRESSBAR_ARROW); } @Override @@ -1292,6 +1315,13 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ return !this.mSharedTank; } + @Override + protected ProgressBar createProgressBar( + UITexture texture, int imageSize, ProgressBar.Direction direction, Pos2d pos, Size size) { + return super.createProgressBar(texture, imageSize, direction, pos, size) + .setTexture(progressBarTexture.get(), mRecipes.getProgressBarImageSize()); + } + public enum X { PUMP, WIRE, diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java index 9af6e45885..57164de89e 100644 --- a/src/main/java/gregtech/api/util/GT_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Recipe.java @@ -3402,6 +3402,10 @@ public class GT_Recipe implements Comparable<GT_Recipe> { return progressBarTexture.get(); } + public FallbackableUITexture getProgressBarTextureRaw() { + return progressBarTexture; + } + public UITexture getProgressBarTextureSteam(SteamVariant steamVariant) { return progressBarTextureSteam.get(steamVariant); } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java index 17e9e94b9c..1c1ed70c20 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java @@ -3,6 +3,8 @@ package gregtech.common.tileentities.machines.basic; import static gregtech.api.enums.GT_Values.V; import static gregtech.api.enums.GT_Values.debugBlockMiner; +import com.gtnewhorizons.modularui.api.drawable.FallbackableUITexture; +import com.gtnewhorizons.modularui.api.drawable.UITexture; import com.gtnewhorizons.modularui.api.math.Pos2d; import com.gtnewhorizons.modularui.api.math.Size; import com.gtnewhorizons.modularui.api.screen.ModularWindow; @@ -438,14 +440,13 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine return true; } + private static final FallbackableUITexture progressBarTexture = new FallbackableUITexture( + UITexture.fullImage("gregtech", "gui/progressbar/miner"), GT_UITextures.PROGRESSBAR_CANNER); + @Override public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { super.addUIWidgets(builder, buildContext); builder.widget(createProgressBar( - GT_UITextures.PROGRESSBAR_CANNER, - 20, - ProgressBar.Direction.RIGHT, - new Pos2d(78, 24), - new Size(20, 18))); + progressBarTexture.get(), 20, ProgressBar.Direction.RIGHT, new Pos2d(78, 24), new Size(20, 18))); } } diff --git a/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java b/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java index b39d2332d4..7dd73465c8 100644 --- a/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java +++ b/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java @@ -3935,6 +3935,7 @@ public class GT_Loader_MetaTileEntities implements Runnable { // TODO CHECK CIRC 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.COIL_HEATING }) + .setProgressBarTextureName("E_Furnace") .getStackForm(1L)); ItemList.Machine_MV_E_Furnace.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe( 262, @@ -3967,6 +3968,7 @@ public class GT_Loader_MetaTileEntities implements Runnable { // TODO CHECK CIRC 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.COIL_HEATING }) + .setProgressBarTextureName("E_Furnace") .getStackForm(1L)); ItemList.Machine_HV_E_Furnace.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe( 263, @@ -3999,6 +4001,7 @@ public class GT_Loader_MetaTileEntities implements Runnable { // TODO CHECK CIRC 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.COIL_HEATING }) + .setProgressBarTextureName("E_Furnace") .getStackForm(1L)); ItemList.Machine_EV_E_Furnace.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe( 264, @@ -4031,6 +4034,7 @@ public class GT_Loader_MetaTileEntities implements Runnable { // TODO CHECK CIRC 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.COIL_HEATING }) + .setProgressBarTextureName("E_Furnace") .getStackForm(1L)); ItemList.Machine_IV_E_Furnace.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe( 265, @@ -4063,6 +4067,7 @@ public class GT_Loader_MetaTileEntities implements Runnable { // TODO CHECK CIRC 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.COIL_HEATING }) + .setProgressBarTextureName("E_Furnace") .getStackForm(1L)); ItemList.Machine_LV_Extractor.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe( @@ -10856,6 +10861,7 @@ public class GT_Loader_MetaTileEntities implements Runnable { // TODO CHECK CIRC 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.COIL_HEATING }) + .setProgressBarTextureName("E_Oven") .getStackForm(1L)); ItemList.Machine_MV_Oven.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe( 672, @@ -10888,6 +10894,7 @@ public class GT_Loader_MetaTileEntities implements Runnable { // TODO CHECK CIRC 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.COIL_HEATING }) + .setProgressBarTextureName("E_Oven") .getStackForm(1L)); ItemList.Machine_HV_Oven.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe( 673, @@ -10920,6 +10927,7 @@ public class GT_Loader_MetaTileEntities implements Runnable { // TODO CHECK CIRC 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.COIL_HEATING }) + .setProgressBarTextureName("E_Oven") .getStackForm(1L)); ItemList.Machine_EV_Oven.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe( 674, @@ -10952,6 +10960,7 @@ public class GT_Loader_MetaTileEntities implements Runnable { // TODO CHECK CIRC 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.COIL_HEATING }) + .setProgressBarTextureName("E_Oven") .getStackForm(1L)); ItemList.Machine_IV_Oven.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe( 675, @@ -10984,6 +10993,7 @@ public class GT_Loader_MetaTileEntities implements Runnable { // TODO CHECK CIRC 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.COIL_HEATING }) + .setProgressBarTextureName("E_Oven") .getStackForm(1L)); ItemList.Machine_LV_Miner.set( |
