|
11 | 11 | import gregtech.api.metatileentity.multiblock.MultiblockAbility; |
12 | 12 | import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; |
13 | 13 | import gregtech.api.mui.GTGuiTextures; |
| 14 | +import gregtech.api.mui.GTGuiTheme; |
14 | 15 | import gregtech.api.mui.GTGuis; |
15 | 16 | import gregtech.api.mui.sync.GTFluidSyncHandler; |
16 | | -import gregtech.api.util.TextFormattingUtil; |
17 | 17 | import gregtech.client.renderer.ICubeRenderer; |
18 | 18 | import gregtech.client.renderer.texture.Textures; |
19 | 19 | import gregtech.client.renderer.texture.cube.SimpleOverlayRenderer; |
|
38 | 38 | import com.cleanroommc.modularui.api.drawable.IKey; |
39 | 39 | import com.cleanroommc.modularui.factory.PosGuiData; |
40 | 40 | import com.cleanroommc.modularui.screen.ModularPanel; |
| 41 | +import com.cleanroommc.modularui.utils.Alignment; |
| 42 | +import com.cleanroommc.modularui.utils.Color; |
41 | 43 | import com.cleanroommc.modularui.value.sync.PanelSyncManager; |
42 | 44 | import com.cleanroommc.modularui.value.sync.SyncHandlers; |
43 | 45 | import com.cleanroommc.modularui.widgets.ItemSlot; |
| 46 | +import com.cleanroommc.modularui.widgets.RichTextWidget; |
44 | 47 | import com.cleanroommc.modularui.widgets.SlotGroupWidget; |
45 | 48 | import org.jetbrains.annotations.Nullable; |
46 | 49 |
|
@@ -136,59 +139,50 @@ public boolean usesMui2() { |
136 | 139 |
|
137 | 140 | @Override |
138 | 141 | public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager) { |
139 | | - guiSyncManager.registerSlotGroup("item_inv", 1); |
| 142 | + guiSyncManager.registerSlotGroup("item_inv", 2); |
140 | 143 |
|
141 | | - GTFluidSyncHandler tankSyncHandler = new GTFluidSyncHandler(this.importFluids.getTankAt(0)); |
| 144 | + GTFluidSyncHandler tankSyncHandler = GTFluidSlot.sync(this.importFluids.getTankAt(0)) |
| 145 | + .showAmount(false); |
142 | 146 |
|
143 | 147 | return GTGuis.createPanel(this, 176, 166) |
144 | | - .background(IS_STEEL ? GTGuiTextures.BACKGROUND_STEEL : GTGuiTextures.BACKGROUND_BRONZE) |
145 | 148 | .child(IKey.lang(getMetaFullName()).asWidget().pos(5, 5)) |
146 | | - .child(SlotGroupWidget |
147 | | - .playerInventory((index, slot) -> slot |
148 | | - .background(IS_STEEL ? GTGuiTextures.SLOT_STEEL : GTGuiTextures.SLOT_BRONZE)) |
149 | | - .left(7).bottom(7)) |
| 149 | + .child(SlotGroupWidget.playerInventory().left(7).bottom(7)) |
150 | 150 | .child((IS_STEEL ? GTGuiTextures.DISPLAY_STEEL : GTGuiTextures.DISPLAY_BRONZE).asWidget() |
151 | 151 | .left(7).top(16) |
152 | 152 | .size(81, 55)) |
153 | 153 | .child(GTGuiTextures.TANK_ICON.asWidget() |
154 | 154 | .left(92).top(36) |
155 | 155 | .size(14, 15)) |
156 | | - .child(IKey.lang("gregtech.gui.fluid_amount").color(0xFFFFFF).asWidget().pos(11, 20)) |
157 | | - .child(IKey.dynamic(() -> getFluidAmountFormatted(tankSyncHandler)) |
158 | | - .color(0xFFFFFF) |
159 | | - .asWidget().pos(11, 30)) |
160 | | - .child(IKey.dynamic(() -> getFluidNameTranslated(tankSyncHandler)) |
161 | | - .color(0xFFFFFF) |
162 | | - .asWidget().pos(11, 40)) |
| 156 | + .child(new RichTextWidget() |
| 157 | + .size(75, 47) |
| 158 | + .pos(10, 20) |
| 159 | + .textColor(Color.WHITE.main) |
| 160 | + .alignment(Alignment.TopLeft) |
| 161 | + .autoUpdate(true) |
| 162 | + .textBuilder(richText -> { |
| 163 | + richText.addLine(IKey.lang("gregtech.gui.fluid_amount")); |
| 164 | + String name = tankSyncHandler.getFluidLocalizedName(); |
| 165 | + if (name == null) return; |
| 166 | + |
| 167 | + richText.addLine(IKey.str(name)); |
| 168 | + richText.addLine(IKey.str(tankSyncHandler.getFormattedFluidAmount())); |
| 169 | + })) |
163 | 170 | .child(new GTFluidSlot().syncHandler(tankSyncHandler) |
164 | | - .pos(69, 52)) |
| 171 | + .pos(69, 52) |
| 172 | + .disableBackground()) |
165 | 173 | .child(new ItemSlot().slot(SyncHandlers.itemSlot(this.importItems, 0) |
166 | 174 | .slotGroup("item_inv") |
167 | 175 | .filter(itemStack -> FluidUtil.getFluidHandler(itemStack) != null)) |
168 | | - .background(IS_STEEL ? GTGuiTextures.SLOT_STEEL : GTGuiTextures.SLOT_BRONZE, |
169 | | - IS_STEEL ? GTGuiTextures.IN_SLOT_OVERLAY_STEEL : GTGuiTextures.IN_SLOT_OVERLAY_BRONZE) |
170 | 176 | .pos(90, 16)) |
171 | 177 | .child(new ItemSlot().slot(SyncHandlers.itemSlot(this.exportItems, 0) |
| 178 | + .slotGroup("item_inv") |
172 | 179 | .accessibility(false, true)) |
173 | | - .background(IS_STEEL ? GTGuiTextures.SLOT_STEEL : GTGuiTextures.SLOT_BRONZE, |
174 | | - IS_STEEL ? GTGuiTextures.OUT_SLOT_OVERLAY_STEEL : GTGuiTextures.OUT_SLOT_OVERLAY_BRONZE) |
175 | 180 | .pos(90, 53)); |
176 | 181 | } |
177 | 182 |
|
178 | | - private String getFluidNameTranslated(GTFluidSyncHandler tankSyncHandler) { |
179 | | - if (tankSyncHandler.getFluid() == null) { |
180 | | - return ""; |
181 | | - } else { |
182 | | - return tankSyncHandler.getFluid().getLocalizedName(); |
183 | | - } |
184 | | - } |
185 | | - |
186 | | - private String getFluidAmountFormatted(GTFluidSyncHandler tankSyncHandler) { |
187 | | - if (tankSyncHandler.getFluid() == null) { |
188 | | - return "0"; |
189 | | - } else { |
190 | | - return TextFormattingUtil.formatNumbers(tankSyncHandler.getFluid().amount); |
191 | | - } |
| 183 | + @Override |
| 184 | + public GTGuiTheme getUITheme() { |
| 185 | + return IS_STEEL ? GTGuiTheme.STEEL : GTGuiTheme.BRONZE; |
192 | 186 | } |
193 | 187 |
|
194 | 188 | @Override |
|
0 commit comments