Skip to content

Commit

Permalink
fix rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
ghzdude committed Jan 8, 2025
1 parent 71507c8 commit 155e1db
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -183,7 +183,7 @@ protected void addFuelText(List<ITextComponent> 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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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();
Expand All @@ -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)
Expand All @@ -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);

Expand Down Expand Up @@ -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()
Expand All @@ -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)
Expand All @@ -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() ?
Expand All @@ -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)
Expand All @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 155e1db

Please sign in to comment.