diff --git a/src/main/java/gregtech/api/gui/modularui/GTUITextures.java b/src/main/java/gregtech/api/gui/modularui/GTUITextures.java index 4ea333c5011..9293b9b1fad 100644 --- a/src/main/java/gregtech/api/gui/modularui/GTUITextures.java +++ b/src/main/java/gregtech/api/gui/modularui/GTUITextures.java @@ -216,6 +216,10 @@ public class GTUITextures { .fullImage(GregTech.ID, "gui/progressbar/water_plasma_heater"); public static final UITexture PROGRESSBAR_UV_TREATMENT = UITexture .fullImage(GregTech.ID, "gui/progressbar/uvtreatment"); + public static final UITexture PROGRESSBAR_STEAM_FILL = UITexture + .fullImage(GregTech.ID, "gui/progressbar/steam_fill"); + public static final UITexture PROGRESSBAR_STEAM_FILL_STEEL = UITexture + .fullImage(GregTech.ID, "gui/progressbar/steam_fill_steel"); public static FallbackableUITexture fallbackableProgressbar(String name, UITexture fallback) { return new FallbackableUITexture(UITexture.fullImage(GregTech.ID, "gui/progressbar/" + name), fallback); diff --git a/src/main/java/gregtech/api/metatileentity/implementations/MTEBasicMachine.java b/src/main/java/gregtech/api/metatileentity/implementations/MTEBasicMachine.java index 18efdb07c9b..98c27dcd329 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/MTEBasicMachine.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/MTEBasicMachine.java @@ -59,6 +59,7 @@ import gregtech.GTMod; import gregtech.api.GregTechAPI; import gregtech.api.enums.SoundResource; +import gregtech.api.enums.SteamVariant; import gregtech.api.gui.modularui.GTUIInfos; import gregtech.api.gui.modularui.GTUITextures; import gregtech.api.gui.modularui.SteamTexture; @@ -1298,6 +1299,8 @@ public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildCont if (!isSteampowered()) { builder.widget(createFluidAutoOutputButton()); builder.widget(createItemAutoOutputButton()); + } else { + builder.widget(createSteamProgressBar(builder)); } BasicUIProperties uiProperties = getUIProperties(); @@ -1462,6 +1465,26 @@ protected CycleButtonWidget createFluidAutoOutputButton() { .setSize(18, 18); } + // Used for ui syncing + private long getSteamVar = 0; + + protected Widget createSteamProgressBar(ModularWindow.Builder builder) { + builder.widget(new FakeSyncWidget.LongSyncer(this::getSteamVar, val -> getSteamVar = val)); + + return new ProgressBar().setProgress(() -> (float) getSteamVar() / maxSteamStore()) + .setDirection(ProgressBar.Direction.UP) + .setTexture( + getSteamVariant() == SteamVariant.BRONZE ? GTUITextures.PROGRESSBAR_STEAM_FILL + : GTUITextures.PROGRESSBAR_STEAM_FILL_STEEL, + 54) + .setSynced(true, false) + .dynamicTooltip(() -> Collections.singletonList("Steam: " + getSteamVar + "/" + maxSteamStore() + "L")) + .setTooltipShowUpDelay(TOOLTIP_DELAY) + .setUpdateTooltipEveryTick(true) + .setSize(10, 54) + .setPos(7, 24); + } + protected Widget setNEITransferRect(Widget widget, String transferRectID) { if (GTUtility.isStringInvalid(transferRectID)) { return widget; diff --git a/src/main/resources/assets/gregtech/textures/gui/progressbar/steam_fill.png b/src/main/resources/assets/gregtech/textures/gui/progressbar/steam_fill.png new file mode 100644 index 00000000000..5f2081135f9 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/progressbar/steam_fill.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/progressbar/steam_fill_steel.png b/src/main/resources/assets/gregtech/textures/gui/progressbar/steam_fill_steel.png new file mode 100644 index 00000000000..116370bf4ac Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/progressbar/steam_fill_steel.png differ