From 52e6a287b205ea5db77913ba6aa35fc10377b122 Mon Sep 17 00:00:00 2001 From: cubefury Date: Mon, 20 Apr 2026 14:48:51 +0800 Subject: [PATCH 1/5] Clean up io slot text and background, swap out deprecated methods --- .../blocks/gui/MTEVendingMachineGui.java | 46 ++++++++++-------- .../vendingmachine/blocks/gui/TradeRow.java | 6 ++- .../assets/vendingmachine/lang/en_US.lang | 2 + .../textures/gui/background/input.png | Bin 797 -> 337 bytes .../textures/gui/background/output.png | Bin 762 -> 315 bytes 5 files changed, 33 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/cubefury/vendingmachine/blocks/gui/MTEVendingMachineGui.java b/src/main/java/com/cubefury/vendingmachine/blocks/gui/MTEVendingMachineGui.java index 24637e1a..e5c1f7f1 100644 --- a/src/main/java/com/cubefury/vendingmachine/blocks/gui/MTEVendingMachineGui.java +++ b/src/main/java/com/cubefury/vendingmachine/blocks/gui/MTEVendingMachineGui.java @@ -9,6 +9,7 @@ import java.util.UUID; import java.util.stream.Collectors; +import com.cleanroommc.modularui.api.GuiAxis; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; @@ -146,7 +147,7 @@ public ModularPanel build(PosGuiData guiData, PanelSyncManager syncManager, UISe } }); panel.child(createCategoryTabs(this.tabController)); - Flow mainColumn = new Column().width(170); + Flow mainColumn = new Flow(GuiAxis.Y).width(170); if (VendingMachine.proxy.isClient()) { // client side sort and filtering panel.child(createQolButtonColumn()); mainColumn.child( @@ -161,7 +162,7 @@ public ModularPanel build(PosGuiData guiData, PanelSyncManager syncManager, UISe mainColumn.child(createInventoryRow()); panel.child(mainColumn); panel.child( - new Column().size(20) + new Flow(GuiAxis.Y).size(20) .right(5)); panel.child(createIOColumn()); return panel; @@ -175,7 +176,7 @@ public void restorePreviousSettings() { } public IWidget createQolButtonColumn() { - Flow buttonColumn = new Column().width(8) + Flow buttonColumn = new Flow(GuiAxis.Y).width(8) .height(20) .left(-17) .top(1) @@ -221,7 +222,7 @@ public IWidget createQolButtonColumn() { } public IWidget createCategoryTabs(PagedWidget.Controller tabController) { - Flow tabColumn = new Column().width(40) + Flow tabColumn = new Flow(GuiAxis.Y).width(40) .height(300) .left(-29) .top(40) @@ -361,18 +362,21 @@ private IWidget createIOColumn() { .top(40) .widgetTheme(WidgetThemes.BACKGROUND_SIDEPANEL) .child( - new Column().child( + new Flow(GuiAxis.Y).child( GuiTextures.INPUT_SPRITE.asWidget() .leftRel(0.5f) .top(8) .width(30) .height(20)) .child( - new Row().child(createInputSlots().center()) + (IWidget) new TextWidget(IKey.lang("vendingmachine.gui.in")).textAlign(Alignment.CENTER).top(8).widthRel(1.0f) + ) + .child( + new Flow(GuiAxis.X).child(createInputSlots().center()) .top(20) .height(18 * 4)) .child( - new Row().child( + new Flow(GuiAxis.X).child( new ToggleButton().overlay(GTGuiTextures.OVERLAY_BUTTON_CYCLIC) .tooltipBuilder(t -> t.addLine(IKey.lang("vendingmachine.gui.item_eject"))) .syncHandler("ejectItems") @@ -389,11 +393,14 @@ private IWidget createIOColumn() { .child( GuiTextures.OUTPUT_SPRITE.asWidget() .leftRel(0.5f) - .bottom(70) + .bottom(73) .width(30) .height(20)) .child( - new Row().child(createOutputSlots().center()) + (IWidget) new TextWidget(IKey.lang("vendingmachine.gui.out")).textAlign(Alignment.CENTER).bottom(81).widthRel(1.0f) + ) + .child( + new Flow(GuiAxis.X).child(createOutputSlots().center()) .bottom(6) .height(18 * 4)) .right(1)); @@ -538,10 +545,10 @@ private IWidget createTradeUI(TradeMainPanel rootPanel, PagedWidget.Controller t .height(144) .collapseDisabledChild(true); - tradeList.child(new Row().height(2)); + tradeList.child(new Flow(GuiAxis.X).height(2)); // Incomplete Structure status message - Flow statusRow = new Row().height(10).width(TRADE_ROW_WIDTH).marginLeft(2) + Flow statusRow = new Flow(GuiAxis.X).height(10).width(TRADE_ROW_WIDTH).marginLeft(2) .child(new TextWidget(IKey.lang("vendingmachine.gui.error.incomplete_structure"))) .setEnabledIf(slot -> !this.getBase().getActive()); tradeList.child(statusRow); @@ -607,11 +614,11 @@ private IWidget createTradeUI(TradeMainPanel rootPanel, PagedWidget.Controller t row = new TradeRow().height(LIST_ITEM_HEIGHT).width(TRADE_ROW_WIDTH).marginLeft(2); } - tradeList.child(new Row().height(2)); // bottom padding for last row + tradeList.child(new Flow(GuiAxis.X).height(2)); // bottom padding for last row paged.addPage(tradeList); } - return new Row().child(paged.top(0)) + return new Flow(GuiAxis.X).child(paged.top(0)) .left(3) .top(24); } @@ -628,19 +635,19 @@ private static String getReadableStringFromCoinAmount(int amount) { } private IWidget createCoinInventoryRow(TradeMainPanel panel, PanelSyncManager syncManager) { - Flow parent = new Row() // .background(GuiTextures.TEXT_FIELD_BACKGROUND) + Flow parent = new Flow(GuiAxis.X) // .background(GuiTextures.TEXT_FIELD_BACKGROUND) .width(162) .height(36) .top(172) .left(3); - Flow coinColumn = new Column().width(COIN_COLUMN_WIDTH); + Flow coinColumn = new Flow(GuiAxis.Y).width(COIN_COLUMN_WIDTH); int coinCount = 0; for (CurrencyType type : CurrencyType.values()) { coinColumn.child(createCoinDisplay(panel, type, syncManager)); if (++coinCount % COIN_COLUMN_ROW_COUNT == 0) { parent.child(coinColumn.left(3 + COIN_COLUMN_WIDTH * (coinCount / COIN_COLUMN_ROW_COUNT - 1))); - coinColumn = new Column().width(COIN_COLUMN_WIDTH); + coinColumn = new Flow(GuiAxis.Y).width(COIN_COLUMN_WIDTH); } } if (coinColumn.hasChildren()) { @@ -651,7 +658,7 @@ private IWidget createCoinInventoryRow(TradeMainPanel panel, PanelSyncManager sy private IWidget createCoinDisplay(TradeMainPanel panel, CurrencyType type, PanelSyncManager syncManager) { IntSyncValue coinSyncValue = syncManager.findSyncHandler("coinAmount_" + type.id, 0, IntSyncValue.class); - return new Row().child( + return new Flow(GuiAxis.X).child( new CoinButton(panel, type).overlay( type.texture.asIcon() .size(12)) @@ -679,9 +686,10 @@ private IWidget createCoinDisplay(TradeMainPanel panel, CurrencyType type, Panel // why is the original method private lmao private IWidget createInventoryRow() { - return new Row().widthRel(1) + return new Flow(GuiAxis.X).widthRel(1) .height(76) - .alignX(0) + .leftRel(0) + .anchorLeft(0) .bottom(5) .childIf( base.doesBindPlayerInventory(), diff --git a/src/main/java/com/cubefury/vendingmachine/blocks/gui/TradeRow.java b/src/main/java/com/cubefury/vendingmachine/blocks/gui/TradeRow.java index a4ec70bd..0663d6ff 100644 --- a/src/main/java/com/cubefury/vendingmachine/blocks/gui/TradeRow.java +++ b/src/main/java/com/cubefury/vendingmachine/blocks/gui/TradeRow.java @@ -1,12 +1,14 @@ package com.cubefury.vendingmachine.blocks.gui; +import com.cleanroommc.modularui.api.GuiAxis; import com.cleanroommc.modularui.api.widget.IWidget; +import com.cleanroommc.modularui.widgets.layout.Flow; import com.cleanroommc.modularui.widgets.layout.Row; -public class TradeRow extends Row { +public class TradeRow extends Flow { public TradeRow() { - super(); + super(GuiAxis.X); this.collapseDisabledChild(true) .setEnabledIf( r -> r.getChildren() diff --git a/src/main/resources/assets/vendingmachine/lang/en_US.lang b/src/main/resources/assets/vendingmachine/lang/en_US.lang index 5d8f3188..4151f9a5 100644 --- a/src/main/resources/assets/vendingmachine/lang/en_US.lang +++ b/src/main/resources/assets/vendingmachine/lang/en_US.lang @@ -28,6 +28,8 @@ vendingmachine.gui.cooldown_display.second=s vendingmachine.gui.cooldown_display.minute=m vendingmachine.gui.cooldown_display.hour=h vendingmachine.gui.cooldown_display.day=d +vendingmachine.gui.in=IN +vendingmachine.gui.out=OUT vendingmachine.gui.error.incomplete_structure=Incomplete Structure. vendingmachine.gui.error.player_using=Someone is using the vending machine at the moment. diff --git a/src/main/resources/assets/vendingmachine/textures/gui/background/input.png b/src/main/resources/assets/vendingmachine/textures/gui/background/input.png index d1f01f71c06c8bf9eff4c244d06c173829fafb8c..4f3005c8e6414ee8ff49329a258b4f2074589cf3 100644 GIT binary patch delta 250 zcmV|3920{{j~zeVL34HE#+5pGQ#aJB)sCVoT#fcgpSZj{D- z=wOMdpTNF@5_kv&mWkKRl6VZ=;MT+wwRo!6Y#mrqPy$_Zc60E*xU_bIeFs`xg96KU z97~YkT68o_(La~;y|m~yv8Ld1qf^u2<4*j3;(WjIOEbU@R^VOJ;gK_G5Y{%xt?|Oz zMmZM^!qSF0XcA5}UPFtD;1r&Nis2CMh6V+IFRo%7Je5a-xBvhE07*qoM6N<$f(cY` Ab^rhX delta 714 zcmV;*0yX{70-XksUw;CqNklQalKr5*KFDJ<~mdh!R3B z2`CCG9^6n71y4By3<%;u^yByiJc>s>m|f$paf?e_;!Ior_v*c_>1Dces3iTW-v9Sr zbyam#6h#WQ_kp@ud90#=8DZ0GQyB*ToQO%9)R|RL<%x=jaevS9lmM?qK<%B18h^=F z$o?5?w#eFSQ5S2Q*hY)@t{AI*Fb5z;j|0=gRRP}uc>Qy>@W#H__CJb$OTT=E1z$}D zNV`{XE-G(MFJ2Lg+W-%i^5Iro9wG}Id^c$(&Fw<}0&cJH!+WlsXN9vL8^T}3V0m-t zYy5HPtq9#yV1H?__sj$`{JaSAkfQK+F*td90X-n}PHR@nuvBd^7KMWXPKw||-n=Q0 zBCvaYNILUcXISVQ!J3V$e&q7jL+XigOdH?fP)Y#=tLM z4N}M1Sz`+ld-TM!MZ2K=*CeY0?0QY42<^l-Kg|C1@Yg??BH;nFnSD*!|A2F`o=b94 zU=|n!EPq@UX*Xl9$^IQx`cPD#>a|_2@2BGQ;=r7VV_A$$Fbf^TdkTM~ZXVjXj`7NW zSL8u)V?O9$o_;Qv1@{1sL9Ydu%_ou8eK}sMljQr!^LfclEx(&~S1=3j#%(Zd+-*$3 z`DFX_J7p+_5&Qa!bPK@@--`ETt2vq8bEu!-^i7&-poGxC{P8H3)8o zODKw);8J@vNZYG$ZKmkVS7B>W1TVtYpH7L+eJ9C_FT!g@E?qZ1?oafX-=7lg`c7UR z{14tbQ!D-jdy8riJi{o8;w&PYQ3U69pb*rHb32ekp&mTLQK$vauwITrYdFyijz(+v e>K;dBX^-CzO(P^Fw0NHY0000Xx1w&k_kbv~8u;jG{)lkTQGY;8zGQt$#?JRQD+;sWR{E0= z-ST}ZI3Fa{z8v^?@g-9H1(V`Es66*G@JTOft_d&9heM1zl2ANRL6D8h#KN$|!@|EC z9QkeG^I7}cW*mUSqK8e zChEma{C{~7e+k1XE6=QvB7ALj2|62ou4)j;ca|kTC#vQbCS45^!@v&x!np&(g(0g| z)B)>+opyU~`3Bv~L5o0c$Gs?=PDT~=;=%sM1@Coeft&2g+z`g&2*_> Date: Mon, 20 Apr 2026 14:49:12 +0800 Subject: [PATCH 2/5] spotless --- .../blocks/gui/MTEVendingMachineGui.java | 14 +++++++------- .../vendingmachine/blocks/gui/TradeRow.java | 1 - 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/cubefury/vendingmachine/blocks/gui/MTEVendingMachineGui.java b/src/main/java/com/cubefury/vendingmachine/blocks/gui/MTEVendingMachineGui.java index e5c1f7f1..cf456811 100644 --- a/src/main/java/com/cubefury/vendingmachine/blocks/gui/MTEVendingMachineGui.java +++ b/src/main/java/com/cubefury/vendingmachine/blocks/gui/MTEVendingMachineGui.java @@ -9,10 +9,10 @@ import java.util.UUID; import java.util.stream.Collectors; -import com.cleanroommc.modularui.api.GuiAxis; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; +import com.cleanroommc.modularui.api.GuiAxis; import com.cleanroommc.modularui.api.drawable.IKey; import com.cleanroommc.modularui.api.widget.IWidget; import com.cleanroommc.modularui.drawable.DynamicDrawable; @@ -33,9 +33,7 @@ import com.cleanroommc.modularui.widgets.SlotGroupWidget; import com.cleanroommc.modularui.widgets.TextWidget; import com.cleanroommc.modularui.widgets.ToggleButton; -import com.cleanroommc.modularui.widgets.layout.Column; import com.cleanroommc.modularui.widgets.layout.Flow; -import com.cleanroommc.modularui.widgets.layout.Row; import com.cleanroommc.modularui.widgets.slot.ItemSlot; import com.cleanroommc.modularui.widgets.slot.ModularSlot; import com.cubefury.vendingmachine.VMConfig; @@ -369,8 +367,9 @@ private IWidget createIOColumn() { .width(30) .height(20)) .child( - (IWidget) new TextWidget(IKey.lang("vendingmachine.gui.in")).textAlign(Alignment.CENTER).top(8).widthRel(1.0f) - ) + (IWidget) new TextWidget(IKey.lang("vendingmachine.gui.in")).textAlign(Alignment.CENTER) + .top(8) + .widthRel(1.0f)) .child( new Flow(GuiAxis.X).child(createInputSlots().center()) .top(20) @@ -397,8 +396,9 @@ private IWidget createIOColumn() { .width(30) .height(20)) .child( - (IWidget) new TextWidget(IKey.lang("vendingmachine.gui.out")).textAlign(Alignment.CENTER).bottom(81).widthRel(1.0f) - ) + (IWidget) new TextWidget(IKey.lang("vendingmachine.gui.out")).textAlign(Alignment.CENTER) + .bottom(81) + .widthRel(1.0f)) .child( new Flow(GuiAxis.X).child(createOutputSlots().center()) .bottom(6) diff --git a/src/main/java/com/cubefury/vendingmachine/blocks/gui/TradeRow.java b/src/main/java/com/cubefury/vendingmachine/blocks/gui/TradeRow.java index 0663d6ff..6f2b68c1 100644 --- a/src/main/java/com/cubefury/vendingmachine/blocks/gui/TradeRow.java +++ b/src/main/java/com/cubefury/vendingmachine/blocks/gui/TradeRow.java @@ -3,7 +3,6 @@ import com.cleanroommc.modularui.api.GuiAxis; import com.cleanroommc.modularui.api.widget.IWidget; import com.cleanroommc.modularui.widgets.layout.Flow; -import com.cleanroommc.modularui.widgets.layout.Row; public class TradeRow extends Flow { From 9c8296040906e0aa6cea87b66609b5cd9cae8348 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 20 Apr 2026 14:57:13 +0800 Subject: [PATCH 3/5] optimizing images (#85) Co-authored-by: cubefury Co-authored-by: GitHub GTNH Actions <17281699+cubefury@users.noreply.github.com> --- .../textures/gui/background/input.png | Bin 337 -> 286 bytes .../textures/gui/background/output.png | Bin 315 -> 250 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/src/main/resources/assets/vendingmachine/textures/gui/background/input.png b/src/main/resources/assets/vendingmachine/textures/gui/background/input.png index 4f3005c8e6414ee8ff49329a258b4f2074589cf3..509d54f9938bce41232b76e2ecc24684847f59c5 100644 GIT binary patch delta 198 zcmV;%06G8B0-gepV1KDeL_t(Y$Gz0M5ri-d1keo#uYs$9$RXX+hO1d3emZP@kS|aI z);@bQBaj41lnVZ%b`KI>IHsELNL->M0r?>te?m*e35~#e*?1a!2Hwj&VC`Tgy8p*D zI0Lt2{J?K5H4%Q`PFYT8_~VO}xG{XaXe_;??1gB|!c`qC!s z4T$z2BPepwCTtCipen2dM^O{3;StmfM>kimHYa(dn_X3I;Q#;t07*qoM6N<$g2E|P AkpKVy delta 249 zcmV>!1GE?D zfZD+w3MimF>@@KdCAPm<5fC#200v9HMdcU`69CW=ZcQC%enbI)`U&iAl*WDN zV2P=pz`lbLcnAfSiPz1Ncnsa(*2ELFc&gWI9avIO0$p=<@N&Pnw047i2U=W%0?T(C zOOW7NbTmxSKbQ2qwCFamrr>g;Q`6z&PW*o2e82KbGr$g3;9b+7QP diff --git a/src/main/resources/assets/vendingmachine/textures/gui/background/output.png b/src/main/resources/assets/vendingmachine/textures/gui/background/output.png index 4599f707ffc4ea4a6198cbcd690db9c11443872d..42ce1776cbef97c6f3cf716d74e157459ad9115c 100644 GIT binary patch delta 162 zcmV;T0A2sP0{Q`vV1I>4L_t(Y$F0?|4S+xl13(v)EWiw3eaZH}2Gf`V=_P2M*e+5= zr^Jy0l2EE&V81}M-$ET+Mo&Ja;uh-QHmc&*dY!e~nW}i?kQCgWv<(~zUPjx%{>``z zY*jp->0jJJ9o$A$Jc25C46Wiwq7{6?DfACM;WWC!UvL^-;Txsbm%>Tn2L7nDmKqr=Rfu5ZUFm-7!kOQ!w z3dsz}QGuqhfBm;eiJxN2EFy&DI+pBPGrs&L9VQWzYFT&QJPKnNaC&`O1!fQn?H(WmMPxP4IpAzl*PF^1T z58gUcEB*z0i)s)&!zha4EFzmx1m||35Y&rvJCH=79z4TQs0GikUXDU*IMED_Mr-)$ d9!F(qkKYeXBP1oXc%J|O002ovPDHLkV1l<|VcP%z From 6ad482c088bde095cb23850f0a1aa8b473ead7a2 Mon Sep 17 00:00:00 2001 From: cubefury Date: Mon, 20 Apr 2026 18:06:56 +0800 Subject: [PATCH 4/5] swap to row and column factory methods --- .../blocks/gui/MTEVendingMachineGui.java | 95 +++++++++++-------- 1 file changed, 53 insertions(+), 42 deletions(-) diff --git a/src/main/java/com/cubefury/vendingmachine/blocks/gui/MTEVendingMachineGui.java b/src/main/java/com/cubefury/vendingmachine/blocks/gui/MTEVendingMachineGui.java index cf456811..9f8ac9b7 100644 --- a/src/main/java/com/cubefury/vendingmachine/blocks/gui/MTEVendingMachineGui.java +++ b/src/main/java/com/cubefury/vendingmachine/blocks/gui/MTEVendingMachineGui.java @@ -12,7 +12,6 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; -import com.cleanroommc.modularui.api.GuiAxis; import com.cleanroommc.modularui.api.drawable.IKey; import com.cleanroommc.modularui.api.widget.IWidget; import com.cleanroommc.modularui.drawable.DynamicDrawable; @@ -145,7 +144,8 @@ public ModularPanel build(PosGuiData guiData, PanelSyncManager syncManager, UISe } }); panel.child(createCategoryTabs(this.tabController)); - Flow mainColumn = new Flow(GuiAxis.Y).width(170); + Flow mainColumn = Flow.column() + .width(170); if (VendingMachine.proxy.isClient()) { // client side sort and filtering panel.child(createQolButtonColumn()); mainColumn.child( @@ -160,7 +160,8 @@ public ModularPanel build(PosGuiData guiData, PanelSyncManager syncManager, UISe mainColumn.child(createInventoryRow()); panel.child(mainColumn); panel.child( - new Flow(GuiAxis.Y).size(20) + Flow.column() + .size(20) .right(5)); panel.child(createIOColumn()); return panel; @@ -174,7 +175,8 @@ public void restorePreviousSettings() { } public IWidget createQolButtonColumn() { - Flow buttonColumn = new Flow(GuiAxis.Y).width(8) + Flow buttonColumn = Flow.column() + .width(8) .height(20) .left(-17) .top(1) @@ -220,7 +222,8 @@ public IWidget createQolButtonColumn() { } public IWidget createCategoryTabs(PagedWidget.Controller tabController) { - Flow tabColumn = new Flow(GuiAxis.Y).width(40) + Flow tabColumn = Flow.column() + .width(40) .height(300) .left(-29) .top(40) @@ -360,26 +363,29 @@ private IWidget createIOColumn() { .top(40) .widgetTheme(WidgetThemes.BACKGROUND_SIDEPANEL) .child( - new Flow(GuiAxis.Y).child( - GuiTextures.INPUT_SPRITE.asWidget() - .leftRel(0.5f) - .top(8) - .width(30) - .height(20)) + Flow.column() + .child( + GuiTextures.INPUT_SPRITE.asWidget() + .leftRel(0.5f) + .top(8) + .width(30) + .height(20)) .child( (IWidget) new TextWidget(IKey.lang("vendingmachine.gui.in")).textAlign(Alignment.CENTER) .top(8) .widthRel(1.0f)) .child( - new Flow(GuiAxis.X).child(createInputSlots().center()) + Flow.row() + .child(createInputSlots().center()) .top(20) .height(18 * 4)) .child( - new Flow(GuiAxis.X).child( - new ToggleButton().overlay(GTGuiTextures.OVERLAY_BUTTON_CYCLIC) - .tooltipBuilder(t -> t.addLine(IKey.lang("vendingmachine.gui.item_eject"))) - .syncHandler("ejectItems") - .right(6)) + Flow.row() + .child( + new ToggleButton().overlay(GTGuiTextures.OVERLAY_BUTTON_CYCLIC) + .tooltipBuilder(t -> t.addLine(IKey.lang("vendingmachine.gui.item_eject"))) + .syncHandler("ejectItems") + .right(6)) .child( new ToggleButton().overlay( GuiTextures.EJECT_COINS.asIcon() @@ -400,7 +406,8 @@ private IWidget createIOColumn() { .bottom(81) .widthRel(1.0f)) .child( - new Flow(GuiAxis.X).child(createOutputSlots().center()) + Flow.row() + .child(createOutputSlots().center()) .bottom(6) .height(18 * 4)) .right(1)); @@ -545,10 +552,10 @@ private IWidget createTradeUI(TradeMainPanel rootPanel, PagedWidget.Controller t .height(144) .collapseDisabledChild(true); - tradeList.child(new Flow(GuiAxis.X).height(2)); + tradeList.child(Flow.row().height(2)); // Incomplete Structure status message - Flow statusRow = new Flow(GuiAxis.X).height(10).width(TRADE_ROW_WIDTH).marginLeft(2) + Flow statusRow = Flow.row().height(10).width(TRADE_ROW_WIDTH).marginLeft(2) .child(new TextWidget(IKey.lang("vendingmachine.gui.error.incomplete_structure"))) .setEnabledIf(slot -> !this.getBase().getActive()); tradeList.child(statusRow); @@ -614,11 +621,11 @@ private IWidget createTradeUI(TradeMainPanel rootPanel, PagedWidget.Controller t row = new TradeRow().height(LIST_ITEM_HEIGHT).width(TRADE_ROW_WIDTH).marginLeft(2); } - tradeList.child(new Flow(GuiAxis.X).height(2)); // bottom padding for last row + tradeList.child(Flow.row().height(2)); // bottom padding for last row paged.addPage(tradeList); } - return new Flow(GuiAxis.X).child(paged.top(0)) + return Flow.row().child(paged.top(0)) .left(3) .top(24); } @@ -635,19 +642,21 @@ private static String getReadableStringFromCoinAmount(int amount) { } private IWidget createCoinInventoryRow(TradeMainPanel panel, PanelSyncManager syncManager) { - Flow parent = new Flow(GuiAxis.X) // .background(GuiTextures.TEXT_FIELD_BACKGROUND) + Flow parent = Flow.row() // .background(GuiTextures.TEXT_FIELD_BACKGROUND) .width(162) .height(36) .top(172) .left(3); - Flow coinColumn = new Flow(GuiAxis.Y).width(COIN_COLUMN_WIDTH); + Flow coinColumn = Flow.column() + .width(COIN_COLUMN_WIDTH); int coinCount = 0; for (CurrencyType type : CurrencyType.values()) { coinColumn.child(createCoinDisplay(panel, type, syncManager)); if (++coinCount % COIN_COLUMN_ROW_COUNT == 0) { parent.child(coinColumn.left(3 + COIN_COLUMN_WIDTH * (coinCount / COIN_COLUMN_ROW_COUNT - 1))); - coinColumn = new Flow(GuiAxis.Y).width(COIN_COLUMN_WIDTH); + coinColumn = Flow.column() + .width(COIN_COLUMN_WIDTH); } } if (coinColumn.hasChildren()) { @@ -658,22 +667,23 @@ private IWidget createCoinInventoryRow(TradeMainPanel panel, PanelSyncManager sy private IWidget createCoinDisplay(TradeMainPanel panel, CurrencyType type, PanelSyncManager syncManager) { IntSyncValue coinSyncValue = syncManager.findSyncHandler("coinAmount_" + type.id, 0, IntSyncValue.class); - return new Flow(GuiAxis.X).child( - new CoinButton(panel, type).overlay( - type.texture.asIcon() - .size(12)) - .size(12) - .left(0) - .syncHandler("ejectCoin_" + type.id) - .tooltipDynamic((builder) -> { - builder.clearText(); - builder.addLine(coinSyncValue.getValue() + " " + type.getLocalizedName()); - builder.emptyLine(); - builder.addLine( - IKey.str(Translator.translate("vendingmachine.gui.single_coin_type_eject_hint")) - .style(IKey.GRAY, IKey.ITALIC)); - builder.setAutoUpdate(true); - })) + return Flow.row() + .child( + new CoinButton(panel, type).overlay( + type.texture.asIcon() + .size(12)) + .size(12) + .left(0) + .syncHandler("ejectCoin_" + type.id) + .tooltipDynamic((builder) -> { + builder.clearText(); + builder.addLine(coinSyncValue.getValue() + " " + type.getLocalizedName()); + builder.emptyLine(); + builder.addLine( + IKey.str(Translator.translate("vendingmachine.gui.single_coin_type_eject_hint")) + .style(IKey.GRAY, IKey.ITALIC)); + builder.setAutoUpdate(true); + })) .child( IKey.dynamic(() -> getReadableStringFromCoinAmount(coinSyncValue.getValue())) .scale(0.8f) @@ -686,7 +696,8 @@ private IWidget createCoinDisplay(TradeMainPanel panel, CurrencyType type, Panel // why is the original method private lmao private IWidget createInventoryRow() { - return new Flow(GuiAxis.X).widthRel(1) + return Flow.row() + .widthRel(1) .height(76) .leftRel(0) .anchorLeft(0) From 067b8025a8638b1a4806ca1405a2d355f39563b3 Mon Sep 17 00:00:00 2001 From: cubefury Date: Tue, 21 Apr 2026 01:24:39 +0800 Subject: [PATCH 5/5] address comments --- .../vendingmachine/blocks/gui/MTEVendingMachineGui.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/cubefury/vendingmachine/blocks/gui/MTEVendingMachineGui.java b/src/main/java/com/cubefury/vendingmachine/blocks/gui/MTEVendingMachineGui.java index 9f8ac9b7..38a83950 100644 --- a/src/main/java/com/cubefury/vendingmachine/blocks/gui/MTEVendingMachineGui.java +++ b/src/main/java/com/cubefury/vendingmachine/blocks/gui/MTEVendingMachineGui.java @@ -642,7 +642,7 @@ private static String getReadableStringFromCoinAmount(int amount) { } private IWidget createCoinInventoryRow(TradeMainPanel panel, PanelSyncManager syncManager) { - Flow parent = Flow.row() // .background(GuiTextures.TEXT_FIELD_BACKGROUND) + Flow parent = Flow.row() .width(162) .height(36) .top(172)