Skip to content
This repository has been archived by the owner on May 26, 2024. It is now read-only.

Commit

Permalink
Overrides addUIWidgets to properly render steam progress bar
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyfts committed Jul 10, 2023
1 parent d40e006 commit 9466e3b
Showing 1 changed file with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.generators;

import com.gtnewhorizons.modularui.api.screen.ModularWindow;
import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
import com.gtnewhorizons.modularui.common.widget.DrawableWidget;
import com.gtnewhorizons.modularui.common.widget.ProgressBar;
import com.gtnewhorizons.modularui.common.widget.SlotWidget;

import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraftforge.common.util.ForgeDirection;
Expand Down Expand Up @@ -291,6 +297,48 @@ public boolean allowCoverOnSide(ForgeDirection side, GT_ItemStack aCover) {
return super.allowCoverOnSide(side, aCover);
}

@Override
public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) {
builder.widget(
new SlotWidget(inventoryHandler, 0).setPos(43, 25)
.setBackground(getGUITextureSet().getItemSlot(), getOverlaySlotIn()))
.widget(
new SlotWidget(inventoryHandler, 1).setPos(43, 61)
.setBackground(getGUITextureSet().getItemSlot(), getOverlaySlotOut()))
.widget(createFuelSlot())
.widget(createAshSlot())
.widget(
new ProgressBar().setProgress(() -> mSteam == null ? 0 : (float) mSteam.amount / getSteamCapacity())
.setTexture(getProgressbarEmpty(), GT_UITextures.PROGRESSBAR_BOILER_STEAM, 10)
.setDirection(ProgressBar.Direction.UP)
.setPos(70, 25)
.setSize(10, 54))
.widget(
new ProgressBar().setProgress(() -> mFluid == null ? 0 : (float) mFluid.amount / getCapacity())
.setTexture(getProgressbarEmpty(), GT_UITextures.PROGRESSBAR_BOILER_WATER, 10)
.setDirection(ProgressBar.Direction.UP)
.setPos(83, 25)
.setSize(10, 54))
.widget(
new ProgressBar().setProgress(() -> (float) mTemperature / maxProgresstime())
.setTexture(getProgressbarEmpty(), GT_UITextures.PROGRESSBAR_BOILER_HEAT, 10)
.setDirection(ProgressBar.Direction.UP)
.setPos(96, 25)
.setSize(10, 54))
.widget(
new ProgressBar()
// cap minimum so that one can easily see there's fuel remaining
.setProgress(() -> mProcessingEnergy > 0 ? Math.max((float) mProcessingEnergy / 1000, 1f / 5) : 0)
.setTexture(getProgressbarFuel(), 14)
.setDirection(ProgressBar.Direction.UP)
.setPos(116, 45)
.setSize(14, 14))
.widget(
new DrawableWidget().setDrawable(getOverlaySlotCanister())
.setPos(43, 43)
.setSize(18, 18));
}

@Override
public GUITextureSet getGUITextureSet() {
return GUITextureSet.DEFAULT;
Expand Down

0 comments on commit 9466e3b

Please sign in to comment.