diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/FuelMultiblockController.java b/src/main/java/gregtech/api/metatileentity/multiblock/FuelMultiblockController.java index d79b9469984..fb91d3c3084 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/FuelMultiblockController.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/FuelMultiblockController.java @@ -22,7 +22,7 @@ import net.minecraftforge.fluids.FluidStack; import com.cleanroommc.modularui.api.drawable.IKey; -import com.cleanroommc.modularui.screen.Tooltip; +import com.cleanroommc.modularui.screen.RichTooltip; import com.cleanroommc.modularui.value.sync.StringSyncValue; import org.jetbrains.annotations.NotNull; @@ -183,7 +183,7 @@ protected void addFuelText(List textList) { * @param amounts the sync value containing an array of [fuel stored, fuel capacity] * @param fuelNameValue the name of the fuel */ - protected void createFuelTooltip(@NotNull Tooltip tooltip, @NotNull FixedIntArraySyncValue amounts, + protected void createFuelTooltip(@NotNull RichTooltip tooltip, @NotNull FixedIntArraySyncValue amounts, @NotNull StringSyncValue fuelNameValue) { tooltip.setAutoUpdate(true); if (isStructureFormed()) { diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/MultiMapMultiblockController.java b/src/main/java/gregtech/api/metatileentity/multiblock/MultiMapMultiblockController.java index f587caac056..fe116630290 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/MultiMapMultiblockController.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/MultiMapMultiblockController.java @@ -141,7 +141,8 @@ protected MultiblockUIFactory createUIFactory() { return null; return new CycleButtonWidget() - .textureGetter(i -> GTGuiTextures.BUTTON_MULTI_MAP) + // .textureGetter(i -> GTGuiTextures.BUTTON_MULTI_MAP) + .overlay(GTGuiTextures.BUTTON_MULTI_MAP) .background(GTGuiTextures.BUTTON) // TODO find out why this needs to be called .disableHoverBackground() diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/ui/MultiblockUIFactory.java b/src/main/java/gregtech/api/metatileentity/multiblock/ui/MultiblockUIFactory.java index c87e08619a8..9aff07b25ea 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/ui/MultiblockUIFactory.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/ui/MultiblockUIFactory.java @@ -21,7 +21,7 @@ import com.cleanroommc.modularui.api.drawable.IDrawable; import com.cleanroommc.modularui.api.drawable.IKey; import com.cleanroommc.modularui.api.widget.IWidget; -import com.cleanroommc.modularui.drawable.keys.DynamicKey; +import com.cleanroommc.modularui.drawable.text.DynamicKey; import com.cleanroommc.modularui.factory.PosGuiData; import com.cleanroommc.modularui.screen.ModularPanel; import com.cleanroommc.modularui.utils.Alignment; @@ -37,6 +37,7 @@ import com.cleanroommc.modularui.widgets.ProgressWidget; import com.cleanroommc.modularui.widgets.SlotGroupWidget; import com.cleanroommc.modularui.widgets.layout.Column; +import com.cleanroommc.modularui.widgets.layout.Flow; import com.cleanroommc.modularui.widgets.layout.Row; import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; @@ -254,8 +255,8 @@ public MultiblockUIFactory setScreenHeight(int height) { * @param panelSyncManager the sync manager for synchronizing widgets */ @Nullable - protected Column createBars(@NotNull ModularPanel mainPanel, - @NotNull PanelSyncManager panelSyncManager) { + protected Flow createBars(@NotNull ModularPanel mainPanel, + @NotNull PanelSyncManager panelSyncManager) { if (!(mte instanceof ProgressBarMultiblock progressMulti)) return null; final int count = progressMulti.getProgressBarCount(); @@ -265,7 +266,7 @@ protected Column createBars(@NotNull ModularPanel mainPanel, final int rows = progressMulti.getProgressBarRows(); final int cols = progressMulti.getProgressBarCols(); - Column column = new Column() + Flow column = Flow.column() .margin(4, 0) .top(114) .widthRel(1f) @@ -274,7 +275,7 @@ protected Column createBars(@NotNull ModularPanel mainPanel, for (int r = 0; r < rows; r++) { - Row row = new Row() + Flow row = Flow.row() .widthRel(1f) .height(Bars.HEIGHT); @@ -347,7 +348,7 @@ private void resize(IWidget parent) { } @NotNull - protected Column createButtons(@NotNull ModularPanel mainPanel, @NotNull PanelSyncManager panelSyncManager) { + protected Flow createButtons(@NotNull ModularPanel mainPanel, @NotNull PanelSyncManager panelSyncManager) { var flexButton = this.flexButton.apply(mainPanel, panelSyncManager); if (flexButton == null) { flexButton = GTGuiTextures.BUTTON_NO_FLEX.asWidget() @@ -356,7 +357,7 @@ protected Column createButtons(@NotNull ModularPanel mainPanel, @NotNull PanelSy } var powerButton = createPowerButton(mainPanel, panelSyncManager); - return new Column() + return Flow.column() .alignX(1f) .right(4) .size(18, 77) @@ -379,7 +380,9 @@ protected IWidget createDistinctButton(@NotNull ModularPanel mainPanel, return new CycleButtonWidget() .size(18, 18) .value(distinctValue) - .textureGetter(i -> GTGuiTextures.BUTTON_DISTINCT_BUSES[i]) + // .textureGetter(i -> GTGuiTextures.BUTTON_DISTINCT_BUSES[i]) + .stateBackground(true, GTGuiTextures.BUTTON_DISTINCT_BUSES[1]) + .stateBackground(false, GTGuiTextures.BUTTON_DISTINCT_BUSES[0]) .background(GTGuiTextures.BUTTON) .tooltip(tooltip -> tooltip.setAutoUpdate(true)) .tooltipBuilder(t -> t.addLine(distinctValue.getBoolValue() ? @@ -398,7 +401,11 @@ protected IWidget createVoidingButton(@NotNull ModularPanel mainPanel, @NotNull return new CycleButtonWidget() .size(18, 18) - .textureGetter(i -> GTGuiTextures.MULTIBLOCK_VOID[i]) + // .textureGetter(i -> GTGuiTextures.MULTIBLOCK_VOID[i]) + .stateOverlay(0, GTGuiTextures.MULTIBLOCK_VOID[0]) + .stateOverlay(1, GTGuiTextures.MULTIBLOCK_VOID[1]) + .stateOverlay(2, GTGuiTextures.MULTIBLOCK_VOID[2]) + .stateOverlay(3, GTGuiTextures.MULTIBLOCK_VOID[3]) .background(GTGuiTextures.BUTTON) .value(voidingValue) .length(4) @@ -421,7 +428,9 @@ protected Widget createPowerButton(@NotNull ModularPanel mainPanel, @NotNull return new CycleButtonWidget() .size(18) - .textureGetter(i -> GTGuiTextures.BUTTON_POWER[i]) + // .textureGetter(i -> GTGuiTextures.BUTTON_POWER[i]) + .stateOverlay(true, GTGuiTextures.BUTTON_POWER[1]) + .stateOverlay(false, GTGuiTextures.BUTTON_POWER[0]) .disableHoverBackground() .background(GTGuiTextures.BUTTON_POWER_DETAIL.asIcon().size(18, 6).marginTop(24), GTGuiTextures.BUTTON) .value(new BooleanSyncValue(controllable::isWorkingEnabled, controllable::setWorkingEnabled)) diff --git a/src/main/java/gregtech/api/mui/widget/GregtechDisplayScreen.java b/src/main/java/gregtech/api/mui/widget/GregtechDisplayScreen.java index 09d39a2cf3e..3e9d35f96c8 100644 --- a/src/main/java/gregtech/api/mui/widget/GregtechDisplayScreen.java +++ b/src/main/java/gregtech/api/mui/widget/GregtechDisplayScreen.java @@ -15,10 +15,11 @@ import com.cleanroommc.modularui.api.widget.IGuiAction; import com.cleanroommc.modularui.api.widget.Interactable; import com.cleanroommc.modularui.drawable.Stencil; -import com.cleanroommc.modularui.drawable.TextRenderer; +import com.cleanroommc.modularui.drawable.text.TextRenderer; import com.cleanroommc.modularui.network.NetworkUtils; import com.cleanroommc.modularui.screen.ModularScreen; import com.cleanroommc.modularui.screen.viewport.GuiContext; +import com.cleanroommc.modularui.screen.viewport.ModularGuiContext; import com.cleanroommc.modularui.theme.WidgetTheme; import com.cleanroommc.modularui.utils.Alignment; import com.cleanroommc.modularui.utils.HoveredWidgetList; @@ -82,7 +83,7 @@ public void getSelfAt(IViewportStack stack, HoveredWidgetList widgets, int x, in public void getWidgetsAt(IViewportStack stack, HoveredWidgetList widgets, int x, int y) {} @Override - public void draw(GuiContext context, WidgetTheme widgetTheme) { + public void draw(ModularGuiContext context, WidgetTheme widgetTheme) { // draw the keys int x = getArea().getPadding().left; int y = getArea().getPadding().top - scroll.getScrollY().getScroll(); @@ -209,14 +210,14 @@ public boolean isValidSyncHandler(SyncHandler syncHandler) { } @Override - public void preDraw(GuiContext context, boolean transformed) { + public void preDraw(ModularGuiContext context, boolean transformed) { if (!transformed) { Stencil.applyAtZero(this.scroll, context); } } @Override - public void postDraw(GuiContext context, boolean transformed) { + public void postDraw(ModularGuiContext context, boolean transformed) { if (!transformed) { Stencil.remove(); this.scroll.drawScrollbar(); diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityLargeBoiler.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityLargeBoiler.java index a3e2d18bb24..935c04ef6ee 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityLargeBoiler.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityLargeBoiler.java @@ -197,7 +197,8 @@ protected MultiblockUIFactory createUIFactory() { } })) .createFlexButton((panel, syncManager) -> { - PanelSyncHandler throttle = syncManager.panel("throttle_panel", panel, this::makeThrottlePanel); + PanelSyncHandler throttle = (PanelSyncHandler) syncManager.panel("throttle_panel", + this::makeThrottlePanel, true); return new ButtonWidget<>() .width(18)