1616import gregtech .api .mui .GTGuis ;
1717import gregtech .api .util .KeyUtil ;
1818import gregtech .client .renderer .texture .Textures ;
19- import gregtech .common .mui .widget .ScrollableTextWidget ;
2019import gregtech .core .sound .GTSoundEvents ;
2120
2221import net .minecraft .client .resources .I18n ;
4241import com .cleanroommc .modularui .api .drawable .IKey ;
4342import com .cleanroommc .modularui .factory .PosGuiData ;
4443import com .cleanroommc .modularui .screen .ModularPanel ;
45- import com .cleanroommc .modularui .utils . Alignment ;
44+ import com .cleanroommc .modularui .screen . UISettings ;
4645import com .cleanroommc .modularui .value .sync .BooleanSyncValue ;
4746import com .cleanroommc .modularui .value .sync .IntSyncValue ;
4847import com .cleanroommc .modularui .value .sync .PanelSyncManager ;
49- import com .cleanroommc .modularui .value .sync .SyncHandlers ;
50- import com .cleanroommc .modularui .widgets .ItemSlot ;
5148import com .cleanroommc .modularui .widgets .SlotGroupWidget ;
52- import com .cleanroommc .modularui .widgets .layout . Grid ;
49+ import com .cleanroommc .modularui .widgets .slot . ItemSlot ;
5350import org .jetbrains .annotations .NotNull ;
5451import org .jetbrains .annotations .Nullable ;
5552
@@ -112,10 +109,7 @@ public boolean usesMui2() {
112109
113110 @ SuppressWarnings ("DuplicatedCode" )
114111 @ Override
115- public ModularPanel buildUI (PosGuiData guiData , PanelSyncManager panelSyncManager ) {
116- int rowSize = (int ) Math .sqrt (inventorySize );
117- panelSyncManager .registerSlotGroup ("export_items" , rowSize );
118-
112+ public ModularPanel buildUI (PosGuiData guiData , PanelSyncManager panelSyncManager , UISettings settings ) {
119113 IntSyncValue radiusSync = new IntSyncValue (() -> getWorkingArea (minerLogic .getCurrentRadius ()));
120114 BooleanSyncValue isDoneSync = new BooleanSyncValue (minerLogic ::isDone );
121115 BooleanSyncValue isWorkingSync = new BooleanSyncValue (minerLogic ::isWorking );
@@ -140,51 +134,37 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManage
140134 .child (IKey .lang (getMetaFullName ())
141135 .asWidget ()
142136 .pos (5 , 5 ))
143- .child (new ScrollableTextWidget ()
144- .pos (7 + 3 , 15 + 3 )
145- .size (105 - 3 * 2 , 75 - 3 * 2 )
146- .autoUpdate (true )
147- .alignment (Alignment .TopLeft )
148- .textBuilder (text -> {
149- text .addLine (KeyUtil .lang (TextFormatting .WHITE , "gregtech.machine.miner.mining_at" ));
150- text .addLine (KeyUtil .lang (TextFormatting .WHITE , "gregtech.machine.miner.mining_pos_x" ,
151- xPosSync .getIntValue ()));
152- text .addLine (KeyUtil .lang (TextFormatting .WHITE , "gregtech.machine.miner.mining_pos_y" ,
153- yPosSync .getIntValue ()));
154- text .addLine (KeyUtil .lang (TextFormatting .WHITE , "gregtech.machine.miner.mining_pos_z" ,
155- zPosSync .getIntValue ()));
156-
157- text .addLine (KeyUtil .lang (TextFormatting .WHITE , "gregtech.machine.miner.working_area" ,
158- radiusSync .getIntValue (), radiusSync .getIntValue ()));
159-
160- if (isDoneSync .getBoolValue ()) {
161- text .addLine (KeyUtil .lang (TextFormatting .GREEN , "gregtech.machine.miner.done" ));
162- } else if (isWorkingSync .getBoolValue ()) {
163- text .addLine (KeyUtil .lang (TextFormatting .GOLD , "gregtech.machine.miner.working" ));
164- } else if (!isWorkingEnabledSync .getBoolValue ()) {
165- text .addLine (KeyUtil .lang ("gregtech.multiblock.work_paused" ));
166- }
167-
168- if (isInventoryFullSync .getBoolValue ()) {
169- text .addLine (KeyUtil .lang (TextFormatting .RED , "gregtech.machine.miner.invfull" ));
170- }
171-
172- if (!hasEnoughEnergySync .getBoolValue ()) {
173- text .addLine (KeyUtil .lang (TextFormatting .RED , "gregtech.machine.miner.needspower" ));
174- }
175- })
176- .background (GTGuiTextures .DISPLAY .asIcon ()
177- .margin (-3 )))
178- .child (new Grid ()
179- .pos (151 - 18 * 2 , 15 )
180- .minElementMargin (0 )
181- .minColWidth (18 )
182- .minRowHeight (18 )
183- .mapTo (rowSize , inventorySize , index -> new ItemSlot ()
184- .slot (SyncHandlers .itemSlot (exportItems , index )
185- .slotGroup ("export_items" )
186- .accessibility (false , true ))))
187- .child (SlotGroupWidget .playerInventory ()
137+ .child (createMinerWidgets (panelSyncManager , exportItems , inventorySize , GTGuiTextures .DISPLAY , text -> {
138+ text .addLine (KeyUtil .lang (TextFormatting .WHITE , "gregtech.machine.miner.mining_at" ));
139+ text .addLine (KeyUtil .lang (TextFormatting .WHITE , "gregtech.machine.miner.mining_pos_x" ,
140+ xPosSync .getIntValue ()));
141+ text .addLine (KeyUtil .lang (TextFormatting .WHITE , "gregtech.machine.miner.mining_pos_y" ,
142+ yPosSync .getIntValue ()));
143+ text .addLine (KeyUtil .lang (TextFormatting .WHITE , "gregtech.machine.miner.mining_pos_z" ,
144+ zPosSync .getIntValue ()));
145+
146+ text .addLine (KeyUtil .lang (TextFormatting .WHITE , "gregtech.machine.miner.working_area" ,
147+ radiusSync .getIntValue (), radiusSync .getIntValue ()));
148+
149+ if (isDoneSync .getBoolValue ()) {
150+ text .addLine (KeyUtil .lang (TextFormatting .GREEN , "gregtech.machine.miner.done" ));
151+ } else if (isWorkingSync .getBoolValue ()) {
152+ text .addLine (KeyUtil .lang (TextFormatting .GOLD , "gregtech.machine.miner.working" ));
153+ } else if (!isWorkingEnabledSync .getBoolValue ()) {
154+ text .addLine (KeyUtil .lang ("gregtech.multiblock.work_paused" ));
155+ }
156+
157+ if (isInventoryFullSync .getBoolValue ()) {
158+ text .addLine (KeyUtil .lang (TextFormatting .RED , "gregtech.machine.miner.invfull" ));
159+ }
160+
161+ if (!hasEnoughEnergySync .getBoolValue ()) {
162+ text .addLine (KeyUtil .lang (TextFormatting .RED , "gregtech.machine.miner.needspower" ));
163+ }
164+ })
165+ .left (10 )
166+ .top (18 ))
167+ .child (SlotGroupWidget .playerInventory (false )
188168 .left (7 )
189169 .bottom (7 ))
190170 .child (new ItemSlot ()
0 commit comments