Skip to content

Commit

Permalink
Update to MUI 2.5.0-RC1 (#2544)
Browse files Browse the repository at this point in the history
  • Loading branch information
ghzdude authored Jul 20, 2024
1 parent e8259d5 commit 75735fa
Show file tree
Hide file tree
Showing 35 changed files with 97 additions and 103 deletions.
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
dependencies {
// Published dependencies
api("codechicken:codechickenlib:3.2.3.358")
api("com.cleanroommc:modularui:2.4.3") { transitive = false }
api("com.cleanroommc:modularui:2.5.0-rc1") { transitive = false }
api("com.cleanroommc:groovyscript:1.1.1") { transitive = false }
api("CraftTweaker2:CraftTweaker2-MC1120-Main:1.12-4.1.20.700")
api("appeng:ae2-uel:v0.56.4") { transitive = false }
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/gregtech/api/cover/CoverWithUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import com.cleanroommc.modularui.utils.MouseData;
import com.cleanroommc.modularui.value.BoolValue;
import com.cleanroommc.modularui.value.sync.EnumSyncValue;
import com.cleanroommc.modularui.value.sync.GuiSyncManager;
import com.cleanroommc.modularui.value.sync.IntSyncValue;
import com.cleanroommc.modularui.value.sync.PanelSyncManager;
import com.cleanroommc.modularui.widget.ParentWidget;
import com.cleanroommc.modularui.widgets.ToggleButton;
import com.cleanroommc.modularui.widgets.layout.Row;
Expand Down Expand Up @@ -64,7 +64,7 @@ default GTGuiTheme getUITheme() {
}

@Override
default ModularPanel buildUI(SidedPosGuiData guiData, GuiSyncManager guiSyncManager) {
default ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager) {
return null;
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/gregtech/api/items/gui/ItemUIFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import com.cleanroommc.modularui.factory.HandGuiData;
import com.cleanroommc.modularui.screen.ModularPanel;
import com.cleanroommc.modularui.screen.ModularScreen;
import com.cleanroommc.modularui.value.sync.GuiSyncManager;
import com.cleanroommc.modularui.value.sync.PanelSyncManager;
import org.jetbrains.annotations.ApiStatus;

public interface ItemUIFactory extends IItemComponent, IGuiHolder<HandGuiData> {
Expand All @@ -39,7 +39,7 @@ default GTGuiTheme getUITheme() {
}

@Override
default ModularPanel buildUI(HandGuiData guiData, GuiSyncManager guiSyncManager) {
default ModularPanel buildUI(HandGuiData guiData, PanelSyncManager guiSyncManager) {
return null;
}
}
4 changes: 2 additions & 2 deletions src/main/java/gregtech/api/metatileentity/MetaTileEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
import com.cleanroommc.modularui.factory.PosGuiData;
import com.cleanroommc.modularui.screen.ModularPanel;
import com.cleanroommc.modularui.screen.ModularScreen;
import com.cleanroommc.modularui.value.sync.GuiSyncManager;
import com.cleanroommc.modularui.value.sync.PanelSyncManager;
import com.google.common.base.Preconditions;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
Expand Down Expand Up @@ -474,7 +474,7 @@ public GTGuiTheme getUITheme() {
}

@Override
public ModularPanel buildUI(PosGuiData guiData, GuiSyncManager guiSyncManager) {
public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager) {
return null;
}

Expand Down
4 changes: 1 addition & 3 deletions src/main/java/gregtech/api/mui/GTGuis.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ private static class PopupPanel extends ModularPanel {
public PopupPanel(@NotNull String name, int width, int height, boolean disableBelow,
boolean closeOnOutsideClick) {
super(name);
flex().startDefaultMode();
flex().size(width, height).align(Alignment.Center);
flex().endDefaultMode();
size(width, height).align(Alignment.Center);
background(GTGuiTextures.BACKGROUND_POPUP);
child(ButtonWidget.panelCloseButton().top(5).right(5));
this.disableBelow = disableBelow;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraftforge.items.IItemHandler;

import com.cleanroommc.modularui.api.IPanelHandler;
import com.cleanroommc.modularui.api.drawable.IKey;
import com.cleanroommc.modularui.api.widget.IWidget;
import com.cleanroommc.modularui.drawable.ItemDrawable;
Expand Down Expand Up @@ -123,7 +124,7 @@ private void createSelectorPanel() {
}
}

getPanel().getScreen().openPanel(GTGuis.createPopupPanel("circuit_selector", 176, 120)
IPanelHandler.simple(getPanel(), (mainPanel, player) -> GTGuis.createPopupPanel("circuit_selector", 176, 120)
.child(IKey.lang("metaitem.circuit.integrated.gui").asWidget().pos(5, 5))
.child(circuitPreview.asIcon().size(16).asWidget()
.size(18)
Expand All @@ -133,7 +134,8 @@ private void createSelectorPanel() {
.left(7).right(7).top(41).height(4 * 18)
.matrix(options)
.minColWidth(18).minRowHeight(18)
.minElementMargin(0, 0)));
.minElementMargin(0, 0)))
.openPanel();
}

private static class GhostCircuitSyncHandler extends ItemSlotSH {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/gregtech/common/covers/CoverConveyor.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
import com.cleanroommc.modularui.utils.Color;
import com.cleanroommc.modularui.utils.MouseData;
import com.cleanroommc.modularui.value.sync.EnumSyncValue;
import com.cleanroommc.modularui.value.sync.GuiSyncManager;
import com.cleanroommc.modularui.value.sync.IntSyncValue;
import com.cleanroommc.modularui.value.sync.PanelSyncManager;
import com.cleanroommc.modularui.value.sync.StringSyncValue;
import com.cleanroommc.modularui.widget.ParentWidget;
import com.cleanroommc.modularui.widgets.ButtonWidget;
Expand Down Expand Up @@ -504,7 +504,7 @@ public boolean usesMui2() {
}

@Override
public ModularPanel buildUI(SidedPosGuiData guiData, GuiSyncManager guiSyncManager) {
public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager) {
var panel = GTGuis.createPanel(this, 176, 192 + 18);

getItemFilterContainer().setMaxTransferSize(getMaxStackSize());
Expand All @@ -514,7 +514,7 @@ public ModularPanel buildUI(SidedPosGuiData guiData, GuiSyncManager guiSyncManag
.bindPlayerInventory();
}

protected ParentWidget<Column> createUI(ModularPanel mainPanel, GuiSyncManager guiSyncManager) {
protected ParentWidget<Column> createUI(ModularPanel mainPanel, PanelSyncManager guiSyncManager) {
var column = new Column().top(24).margin(7, 0)
.widthRel(1f).coverChildrenHeight();

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/gregtech/common/covers/CoverEnderFluidLink.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import com.cleanroommc.modularui.value.sync.BooleanSyncValue;
import com.cleanroommc.modularui.value.sync.EnumSyncValue;
import com.cleanroommc.modularui.value.sync.FluidSlotSyncHandler;
import com.cleanroommc.modularui.value.sync.GuiSyncManager;
import com.cleanroommc.modularui.value.sync.PanelSyncManager;
import com.cleanroommc.modularui.value.sync.StringSyncValue;
import com.cleanroommc.modularui.widgets.FluidSlot;
import com.cleanroommc.modularui.widgets.ToggleButton;
Expand Down Expand Up @@ -167,7 +167,7 @@ public boolean usesMui2() {
}

@Override
public ModularPanel buildUI(SidedPosGuiData guiData, GuiSyncManager guiSyncManager) {
public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager) {
var panel = GTGuis.createPanel(this, 176, 192);

getFluidFilterContainer().setMaxTransferSize(1);
Expand All @@ -177,7 +177,7 @@ public ModularPanel buildUI(SidedPosGuiData guiData, GuiSyncManager guiSyncManag
.bindPlayerInventory();
}

protected Column createWidgets(ModularPanel panel, GuiSyncManager syncManager) {
protected Column createWidgets(ModularPanel panel, PanelSyncManager syncManager) {
var isPrivate = new BooleanSyncValue(this::isPrivate, this::setPrivate);
isPrivate.updateCacheFromSource(true);

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/gregtech/common/covers/CoverFluidFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import com.cleanroommc.modularui.screen.ModularPanel;
import com.cleanroommc.modularui.utils.Alignment;
import com.cleanroommc.modularui.value.sync.EnumSyncValue;
import com.cleanroommc.modularui.value.sync.GuiSyncManager;
import com.cleanroommc.modularui.value.sync.PanelSyncManager;
import com.cleanroommc.modularui.widgets.SlotGroupWidget;
import com.cleanroommc.modularui.widgets.layout.Column;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -138,7 +138,7 @@ public boolean usesMui2() {
}

@Override
public ModularPanel buildUI(SidedPosGuiData guiData, GuiSyncManager guiSyncManager) {
public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager) {
var filteringMode = new EnumSyncValue<>(FluidFilterMode.class, this::getFilterMode, this::setFilterMode);

guiSyncManager.syncValue("filtering_mode", filteringMode);
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/gregtech/common/covers/CoverFluidRegulator.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import com.cleanroommc.modularui.screen.ModularPanel;
import com.cleanroommc.modularui.utils.Color;
import com.cleanroommc.modularui.value.sync.EnumSyncValue;
import com.cleanroommc.modularui.value.sync.GuiSyncManager;
import com.cleanroommc.modularui.value.sync.PanelSyncManager;
import com.cleanroommc.modularui.value.sync.StringSyncValue;
import com.cleanroommc.modularui.widget.ParentWidget;
import com.cleanroommc.modularui.widgets.textfield.TextFieldWidget;
Expand Down Expand Up @@ -242,12 +242,12 @@ private boolean shouldDisplayAmountSlider() {
}

@Override
public ModularPanel buildUI(SidedPosGuiData guiData, GuiSyncManager guiSyncManager) {
public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager) {
return super.buildUI(guiData, guiSyncManager).height(192 + 36);
}

@Override
protected ParentWidget<?> createUI(ModularPanel mainPanel, GuiSyncManager syncManager) {
protected ParentWidget<?> createUI(ModularPanel mainPanel, PanelSyncManager syncManager) {
var transferMode = new EnumSyncValue<>(TransferMode.class, this::getTransferMode, this::setTransferMode);
transferMode.updateCacheFromSource(true);
syncManager.syncValue("transfer_mode", transferMode);
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/gregtech/common/covers/CoverFluidVoiding.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import com.cleanroommc.modularui.screen.ModularPanel;
import com.cleanroommc.modularui.utils.Color;
import com.cleanroommc.modularui.value.sync.BooleanSyncValue;
import com.cleanroommc.modularui.value.sync.GuiSyncManager;
import com.cleanroommc.modularui.value.sync.PanelSyncManager;
import com.cleanroommc.modularui.widget.ParentWidget;
import com.cleanroommc.modularui.widgets.ToggleButton;
import com.cleanroommc.modularui.widgets.layout.Row;
Expand Down Expand Up @@ -71,12 +71,12 @@ public void renderCover(@NotNull CCRenderState renderState, @NotNull Matrix4 tra
}

@Override
public ModularPanel buildUI(SidedPosGuiData guiData, GuiSyncManager guiSyncManager) {
public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager) {
return super.buildUI(guiData, guiSyncManager).height(192 - 22);
}

@Override
protected ParentWidget<?> createUI(ModularPanel mainPanel, GuiSyncManager syncManager) {
protected ParentWidget<?> createUI(ModularPanel mainPanel, PanelSyncManager syncManager) {
var isWorking = new BooleanSyncValue(this::isWorkingEnabled, this::setWorkingEnabled);

return super.createUI(mainPanel, syncManager)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import com.cleanroommc.modularui.screen.ModularPanel;
import com.cleanroommc.modularui.utils.Color;
import com.cleanroommc.modularui.value.sync.EnumSyncValue;
import com.cleanroommc.modularui.value.sync.GuiSyncManager;
import com.cleanroommc.modularui.value.sync.PanelSyncManager;
import com.cleanroommc.modularui.value.sync.StringSyncValue;
import com.cleanroommc.modularui.widget.ParentWidget;
import com.cleanroommc.modularui.widgets.textfield.TextFieldWidget;
Expand Down Expand Up @@ -100,12 +100,12 @@ public VoidingMode getVoidingMode() {
}

@Override
public ModularPanel buildUI(SidedPosGuiData guiData, GuiSyncManager guiSyncManager) {
public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager) {
return super.buildUI(guiData, guiSyncManager).height(192 + 20);
}

@Override
protected ParentWidget<?> createUI(ModularPanel mainPanel, GuiSyncManager syncManager) {
protected ParentWidget<?> createUI(ModularPanel mainPanel, PanelSyncManager syncManager) {
var voidingMode = new EnumSyncValue<>(VoidingMode.class, this::getVoidingMode, this::setVoidingMode);
syncManager.syncValue("voiding_mode", voidingMode);

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/gregtech/common/covers/CoverItemFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import com.cleanroommc.modularui.screen.ModularPanel;
import com.cleanroommc.modularui.utils.Alignment;
import com.cleanroommc.modularui.value.sync.EnumSyncValue;
import com.cleanroommc.modularui.value.sync.GuiSyncManager;
import com.cleanroommc.modularui.value.sync.PanelSyncManager;
import com.cleanroommc.modularui.widgets.SlotGroupWidget;
import com.cleanroommc.modularui.widgets.layout.Column;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -141,7 +141,7 @@ public boolean usesMui2() {
}

@Override
public ModularPanel buildUI(SidedPosGuiData guiData, GuiSyncManager guiSyncManager) {
public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager) {
var filteringMode = new EnumSyncValue<>(ItemFilterMode.class, this::getFilterMode, this::setFilterMode);

guiSyncManager.syncValue("filtering_mode", filteringMode);
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/gregtech/common/covers/CoverItemVoiding.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import com.cleanroommc.modularui.screen.ModularPanel;
import com.cleanroommc.modularui.utils.Color;
import com.cleanroommc.modularui.value.sync.BooleanSyncValue;
import com.cleanroommc.modularui.value.sync.GuiSyncManager;
import com.cleanroommc.modularui.value.sync.PanelSyncManager;
import com.cleanroommc.modularui.widget.ParentWidget;
import com.cleanroommc.modularui.widgets.ToggleButton;
import com.cleanroommc.modularui.widgets.layout.Column;
Expand Down Expand Up @@ -73,12 +73,12 @@ void voidAny(IItemHandler myItemHandler) {
}

@Override
public ModularPanel buildUI(SidedPosGuiData guiData, GuiSyncManager guiSyncManager) {
public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager) {
return super.buildUI(guiData, guiSyncManager).height(192 - 22);
}

@Override
protected ParentWidget<Column> createUI(ModularPanel mainPanel, GuiSyncManager guiSyncManager) {
protected ParentWidget<Column> createUI(ModularPanel mainPanel, PanelSyncManager guiSyncManager) {
var isWorking = new BooleanSyncValue(this::isWorkingEnabled, this::setWorkingEnabled);

return super.createUI(mainPanel, guiSyncManager)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import com.cleanroommc.modularui.screen.ModularPanel;
import com.cleanroommc.modularui.utils.Color;
import com.cleanroommc.modularui.value.sync.EnumSyncValue;
import com.cleanroommc.modularui.value.sync.GuiSyncManager;
import com.cleanroommc.modularui.value.sync.PanelSyncManager;
import com.cleanroommc.modularui.value.sync.StringSyncValue;
import com.cleanroommc.modularui.widget.ParentWidget;
import com.cleanroommc.modularui.widgets.layout.Column;
Expand Down Expand Up @@ -89,12 +89,12 @@ protected void voidOverflow(IItemHandler myItemHandler) {
}

@Override
public ModularPanel buildUI(SidedPosGuiData guiData, GuiSyncManager guiSyncManager) {
public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager) {
return super.buildUI(guiData, guiSyncManager).height(192 + 18);
}

@Override
protected ParentWidget<Column> createUI(ModularPanel mainPanel, GuiSyncManager guiSyncManager) {
protected ParentWidget<Column> createUI(ModularPanel mainPanel, PanelSyncManager guiSyncManager) {
var voidingMode = new EnumSyncValue<>(VoidingMode.class, this::getVoidingMode, this::setVoidingMode);
guiSyncManager.syncValue("voiding_mode", voidingMode);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import com.cleanroommc.modularui.value.BoolValue;
import com.cleanroommc.modularui.value.sync.BooleanSyncValue;
import com.cleanroommc.modularui.value.sync.EnumSyncValue;
import com.cleanroommc.modularui.value.sync.GuiSyncManager;
import com.cleanroommc.modularui.value.sync.PanelSyncManager;
import com.cleanroommc.modularui.widget.Widget;
import com.cleanroommc.modularui.widgets.ToggleButton;
import com.cleanroommc.modularui.widgets.layout.Column;
Expand Down Expand Up @@ -111,7 +111,7 @@ public boolean usesMui2() {
}

@Override
public ModularPanel buildUI(SidedPosGuiData guiData, GuiSyncManager guiSyncManager) {
public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager) {
EnumSyncValue<ControllerMode> controllerModeValue = new EnumSyncValue<>(ControllerMode.class,
this::getControllerMode, this::setControllerMode);
BooleanSyncValue invertedValue = new BooleanSyncValue(this::isInverted, this::setInverted);
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/gregtech/common/covers/CoverPump.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
import com.cleanroommc.modularui.utils.Color;
import com.cleanroommc.modularui.utils.MouseData;
import com.cleanroommc.modularui.value.sync.EnumSyncValue;
import com.cleanroommc.modularui.value.sync.GuiSyncManager;
import com.cleanroommc.modularui.value.sync.IntSyncValue;
import com.cleanroommc.modularui.value.sync.PanelSyncManager;
import com.cleanroommc.modularui.value.sync.StringSyncValue;
import com.cleanroommc.modularui.widget.ParentWidget;
import com.cleanroommc.modularui.widgets.ButtonWidget;
Expand Down Expand Up @@ -190,7 +190,7 @@ public boolean usesMui2() {
}

@Override
public ModularPanel buildUI(SidedPosGuiData guiData, GuiSyncManager guiSyncManager) {
public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager) {
var panel = GTGuis.createPanel(this, 176, 192);

getFluidFilterContainer().setMaxTransferSize(getMaxTransferRate());
Expand All @@ -200,7 +200,7 @@ public ModularPanel buildUI(SidedPosGuiData guiData, GuiSyncManager guiSyncManag
.bindPlayerInventory();
}

protected ParentWidget<?> createUI(ModularPanel mainPanel, GuiSyncManager syncManager) {
protected ParentWidget<?> createUI(ModularPanel mainPanel, PanelSyncManager syncManager) {
var manualIOmode = new EnumSyncValue<>(ManualImportExportMode.class,
this::getManualImportExportMode, this::setManualImportExportMode);
manualIOmode.updateCacheFromSource(true);
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/gregtech/common/covers/CoverRoboticArm.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import com.cleanroommc.modularui.screen.ModularPanel;
import com.cleanroommc.modularui.utils.Color;
import com.cleanroommc.modularui.value.sync.EnumSyncValue;
import com.cleanroommc.modularui.value.sync.GuiSyncManager;
import com.cleanroommc.modularui.value.sync.PanelSyncManager;
import com.cleanroommc.modularui.value.sync.StringSyncValue;
import com.cleanroommc.modularui.widget.ParentWidget;
import com.cleanroommc.modularui.widgets.layout.Column;
Expand Down Expand Up @@ -192,12 +192,12 @@ private boolean shouldDisplayAmountSlider() {
}

@Override
public ModularPanel buildUI(SidedPosGuiData guiData, GuiSyncManager guiSyncManager) {
public ModularPanel buildUI(SidedPosGuiData guiData, PanelSyncManager guiSyncManager) {
return super.buildUI(guiData, guiSyncManager).height(192 + 36 + 18 + 2);
}

@Override
protected ParentWidget<Column> createUI(ModularPanel mainPanel, GuiSyncManager guiSyncManager) {
protected ParentWidget<Column> createUI(ModularPanel mainPanel, PanelSyncManager guiSyncManager) {
EnumSyncValue<TransferMode> transferMode = new EnumSyncValue<>(TransferMode.class, this::getTransferMode,
this::setTransferMode);
guiSyncManager.syncValue("transfer_mode", transferMode);
Expand Down
Loading

0 comments on commit 75735fa

Please sign in to comment.