88import gregtech .api .metatileentity .multiblock .IMultiblockAbilityPart ;
99import gregtech .api .metatileentity .multiblock .MultiblockAbility ;
1010import gregtech .api .mui .GTGuiTextures ;
11+ import gregtech .api .mui .GTGuiTheme ;
1112import gregtech .api .mui .GTGuis ;
1213import gregtech .api .mui .sync .GTFluidSyncHandler ;
13- import gregtech .api .util .TextFormattingUtil ;
1414import gregtech .client .renderer .ICubeRenderer ;
1515import gregtech .client .renderer .texture .Textures ;
1616import gregtech .common .metatileentities .multi .multiblockpart .MetaTileEntityMultiblockPart ;
3434import com .cleanroommc .modularui .api .drawable .IKey ;
3535import com .cleanroommc .modularui .factory .PosGuiData ;
3636import com .cleanroommc .modularui .screen .ModularPanel ;
37+ import com .cleanroommc .modularui .utils .Alignment ;
38+ import com .cleanroommc .modularui .utils .Color ;
3739import com .cleanroommc .modularui .value .sync .PanelSyncManager ;
3840import com .cleanroommc .modularui .value .sync .SyncHandlers ;
3941import com .cleanroommc .modularui .widgets .ItemSlot ;
42+ import com .cleanroommc .modularui .widgets .RichTextWidget ;
4043import com .cleanroommc .modularui .widgets .SlotGroupWidget ;
4144import org .jetbrains .annotations .Nullable ;
4245
@@ -122,8 +125,8 @@ public boolean usesMui2() {
122125 public ModularPanel buildUI (PosGuiData guiData , PanelSyncManager guiSyncManager ) {
123126 guiSyncManager .registerSlotGroup ("item_inv" , 2 );
124127
125- // TODO: Use controlsAmount(false) in the sync handler when #2622 is done
126- GTFluidSyncHandler tankSyncHandler = new GTFluidSyncHandler ( this . exportFluids . getTankAt ( 0 ) )
128+ GTFluidSyncHandler tankSyncHandler = GTFluidSlot . sync ( this . exportFluids . getTankAt ( 0 ))
129+ . showAmount ( false )
127130 .accessibility (true , false );
128131
129132 // TODO: Change the position of the name when it's standardized.
@@ -136,15 +139,23 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager)
136139 .child (GTGuiTextures .TANK_ICON .asWidget ()
137140 .left (92 ).top (36 )
138141 .size (14 , 15 ))
139- .child (IKey .lang ("gregtech.gui.fluid_amount" ).color (0xFFFFFF ).asWidget ().pos (11 , 20 ))
140- .child (IKey .dynamic (() -> getFluidAmountFormatted (tankSyncHandler ))
141- .color (0xFFFFFF )
142- .asWidget ().pos (11 , 30 ))
143- .child (IKey .dynamic (() -> getFluidNameTranslated (tankSyncHandler ))
144- .color (0xFFFFFF )
145- .asWidget ().pos (11 , 40 ))
142+ .child (new RichTextWidget ()
143+ .size (75 , 47 )
144+ .pos (10 , 20 )
145+ .textColor (Color .WHITE .main )
146+ .alignment (Alignment .TopLeft )
147+ .autoUpdate (true )
148+ .textBuilder (richText -> {
149+ richText .addLine (IKey .lang ("gregtech.gui.fluid_amount" ));
150+ String name = tankSyncHandler .getFluidLocalizedName ();
151+ if (name == null ) return ;
152+
153+ richText .addLine (IKey .str (name ));
154+ richText .addLine (IKey .str (tankSyncHandler .getFormattedFluidAmount ()));
155+ }))
146156 .child (new GTFluidSlot ().syncHandler (tankSyncHandler )
147- .pos (69 , 52 ))
157+ .pos (69 , 52 )
158+ .disableBackground ())
148159 .child (new ItemSlot ().slot (SyncHandlers .itemSlot (this .importItems , 0 )
149160 .slotGroup ("item_inv" )
150161 .filter (itemStack -> FluidUtil .getFluidHandler (itemStack ) != null ))
@@ -157,20 +168,9 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager)
157168 .pos (90 , 53 ));
158169 }
159170
160- private String getFluidNameTranslated (GTFluidSyncHandler tankSyncHandler ) {
161- if (tankSyncHandler .getFluid () == null ) {
162- return "" ;
163- } else {
164- return tankSyncHandler .getFluid ().getLocalizedName ();
165- }
166- }
167-
168- private String getFluidAmountFormatted (GTFluidSyncHandler tankSyncHandler ) {
169- if (tankSyncHandler .getFluid () == null ) {
170- return "0" ;
171- } else {
172- return TextFormattingUtil .formatNumbers (tankSyncHandler .getFluid ().amount );
173- }
171+ @ Override
172+ public GTGuiTheme getUITheme () {
173+ return GTGuiTheme .PRIMITIVE ;
174174 }
175175
176176 @ Override
0 commit comments