22
33import com .gregtechceu .gtceu .api .GTValues ;
44import com .gregtechceu .gtceu .api .capability .recipe .IO ;
5- import com .gregtechceu .gtceu .api .gui .GuiTextures ;
6- import com .gregtechceu .gtceu .api .gui .UITemplate ;
7- import com .gregtechceu .gtceu .api .gui .widget .TankWidget ;
85import com .gregtechceu .gtceu .api .machine .IMachineBlockEntity ;
96import com .gregtechceu .gtceu .api .machine .MetaMachine ;
107import com .gregtechceu .gtceu .api .machine .TickableSubscription ;
11- import com .gregtechceu .gtceu .api .machine .feature .IDataInfoProvider ;
12- import com .gregtechceu .gtceu .api .machine .feature .IExplosionMachine ;
13- import com .gregtechceu .gtceu .api .machine .feature .IInteractedMachine ;
14- import com .gregtechceu .gtceu .api .machine .feature .IUIMachine ;
8+ import com .gregtechceu .gtceu .api .machine .feature .*;
159import com .gregtechceu .gtceu .api .machine .trait .NotifiableFluidTank ;
10+ import com .gregtechceu .gtceu .api .mui .base .drawable .IKey ;
11+ import com .gregtechceu .gtceu .api .mui .drawable .UITexture ;
12+ import com .gregtechceu .gtceu .api .mui .factory .PosGuiData ;
13+ import com .gregtechceu .gtceu .api .mui .theme .ThemeAPI ;
14+ import com .gregtechceu .gtceu .api .mui .value .sync .FluidSlotSyncHandler ;
15+ import com .gregtechceu .gtceu .api .mui .value .sync .PanelSyncManager ;
16+ import com .gregtechceu .gtceu .api .mui .widgets .ProgressWidget ;
17+ import com .gregtechceu .gtceu .api .mui .widgets .SlotGroupWidget ;
18+ import com .gregtechceu .gtceu .api .mui .widgets .layout .Row ;
19+ import com .gregtechceu .gtceu .api .mui .widgets .slot .FluidSlot ;
1620import com .gregtechceu .gtceu .api .recipe .GTRecipe ;
1721import com .gregtechceu .gtceu .api .recipe .modifier .ModifierFunction ;
1822import com .gregtechceu .gtceu .api .recipe .modifier .RecipeModifier ;
23+ import com .gregtechceu .gtceu .client .mui .screen .ModularPanel ;
24+ import com .gregtechceu .gtceu .client .mui .screen .UISettings ;
1925import com .gregtechceu .gtceu .common .data .GTMaterials ;
26+ import com .gregtechceu .gtceu .common .data .mui .GTMuiWidgets ;
2027import com .gregtechceu .gtceu .common .item .PortableScannerBehavior ;
28+ import com .gregtechceu .gtceu .common .mui .GTGuiTextures ;
29+ import com .gregtechceu .gtceu .common .mui .GTGuis ;
2130import com .gregtechceu .gtceu .config .ConfigHolder ;
2231import com .gregtechceu .gtceu .syncsystem .annotations .SaveField ;
2332import com .gregtechceu .gtceu .syncsystem .annotations .SyncToClient ;
2433import com .gregtechceu .gtceu .utils .FormattingUtil ;
2534import com .gregtechceu .gtceu .utils .GTTransferUtils ;
2635import com .gregtechceu .gtceu .utils .ISubscription ;
2736
28- import com .lowdragmc .lowdraglib .gui .modular .ModularUI ;
29- import com .lowdragmc .lowdraglib .gui .texture .ProgressTexture ;
30- import com .lowdragmc .lowdraglib .gui .widget .ImageWidget ;
31- import com .lowdragmc .lowdraglib .gui .widget .LabelWidget ;
32- import com .lowdragmc .lowdraglib .gui .widget .ProgressWidget ;
33-
3437import net .minecraft .MethodsReturnNonnullByDefault ;
35- import net .minecraft .client .resources .language .I18n ;
3638import net .minecraft .core .BlockPos ;
3739import net .minecraft .core .Direction ;
3840import net .minecraft .core .particles .ParticleTypes ;
6668@ ParametersAreNonnullByDefault
6769@ MethodsReturnNonnullByDefault
6870public abstract class SteamBoilerMachine extends SteamWorkableMachine
69- implements IUIMachine , IExplosionMachine , IDataInfoProvider ,
71+ implements IMuiMachine , IExplosionMachine , IDataInfoProvider ,
7072 IInteractedMachine {
7173
7274 @ SaveField
@@ -186,7 +188,9 @@ protected void updateCurrentTemperature() {
186188 currentTemperature -= getCoolDownRate ();
187189 timeBeforeCoolingDown = getCooldownInterval ();
188190 }
189- } else --timeBeforeCoolingDown ;
191+ } else {
192+ --timeBeforeCoolingDown ;
193+ }
190194
191195 if (getOffsetTimer () % 10 == 0 ) {
192196 if (currentTemperature >= 100 ) {
@@ -200,7 +204,9 @@ protected void updateCurrentTemperature() {
200204 }
201205 if (this .hasNoWater && hasDrainedWater ) {
202206 doExplosion (2.0f );
203- } else this .hasNoWater = !hasDrainedWater ;
207+ } else {
208+ this .hasNoWater = !hasDrainedWater ;
209+ }
204210 if (filledSteam == 0 && hasDrainedWater && getLevel () instanceof ServerLevel serverLevel ) {
205211 final float x = getPos ().getX () + 0.5F ;
206212 final float y = getPos ().getY () + 0.5F ;
@@ -223,9 +229,12 @@ protected void updateCurrentTemperature() {
223229 // bypass capability check for special case behavior
224230 steamTank .drainInternal (FluidType .BUCKET_VOLUME * 4 , FluidAction .EXECUTE );
225231 }
226- } else this .hasNoWater = false ;
232+ } else {
233+ this .hasNoWater = false ;
234+ }
227235 }
228236 updateSteamSubscription ();
237+ syncDataHolder .markClientSyncFieldDirty ("currentTemperature" );
229238 }
230239
231240 protected int getCooldownInterval () {
@@ -313,31 +322,72 @@ public InteractionResult onUse(BlockState state, Level world, BlockPos pos, Play
313322 //////////////////////////////////////
314323 // ********** GUI ***********//
315324 //////////////////////////////////////
316-
317325 @ Override
318- public ModularUI createUI (Player entityPlayer ) {
319- return new ModularUI (176 , 166 , this , entityPlayer )
320- .background (GuiTextures .BACKGROUND_STEAM .get (isHighPressure ))
321- .widget (new LabelWidget (6 , 6 , getBlockState ().getBlock ().getDescriptionId ()))
322- .widget (new ProgressWidget (this ::getTemperaturePercent , 96 , 26 , 10 , 54 )
323- .setProgressTexture (GuiTextures .PROGRESS_BAR_BOILER_EMPTY .get (isHighPressure ),
324- GuiTextures .PROGRESS_BAR_BOILER_HEAT )
325- .setFillDirection (ProgressTexture .FillDirection .DOWN_TO_UP )
326- .setDynamicHoverTips (pct -> I18n .get ("gtceu.multiblock.large_boiler.temperature" ,
327- currentTemperature + 274 , getMaxTemperature () + 274 )))
328- .widget (new TankWidget (waterTank .getStorages ()[0 ], 83 , 26 , 10 , 54 , false , true )
329- .setShowAmount (false )
330- .setFillDirection (ProgressTexture .FillDirection .DOWN_TO_UP )
331- .setBackground (GuiTextures .PROGRESS_BAR_BOILER_EMPTY .get (isHighPressure )))
332- .widget (new TankWidget (steamTank .getStorages ()[0 ], 70 , 26 , 10 , 54 , true , false )
333- .setShowAmount (false )
334- .setFillDirection (ProgressTexture .FillDirection .DOWN_TO_UP )
335- .setBackground (GuiTextures .PROGRESS_BAR_BOILER_EMPTY .get (isHighPressure )))
336- .widget (new ImageWidget (43 , 44 , 18 , 18 , GuiTextures .CANISTER_OVERLAY_STEAM .get (isHighPressure )))
337- .widget (UITemplate .bindPlayerInventory (entityPlayer .getInventory (),
338- GuiTextures .SLOT_STEAM .get (isHighPressure ), 7 , 84 , true ));
326+ public ModularPanel buildUI (PosGuiData data , PanelSyncManager syncManager , UISettings settings ) {
327+ ModularPanel panel = GTGuis .createPanel (this , 176 , 166 );
328+ String theme = this .getDefinition ().getThemeId ();
329+ UITexture backgroundTexture = (UITexture ) ThemeAPI .INSTANCE .getTheme (theme ).getPanelTheme ().getTheme ()
330+ .getBackground ();
331+ panel .child (GTMuiWidgets .createTitleBar (this .getDefinition (), 176 , (UITexture ) backgroundTexture ));
332+
333+ UITexture progressTexture = isHighPressure () ? GTGuiTextures .PROGRESS_BAR_BOILER_EMPTY_STEEL :
334+ GTGuiTextures .PROGRESS_BAR_BOILER_EMPTY_BRONZE ;
335+
336+ panel .child (new Row ()
337+ .top (12 )
338+ .left (50 )
339+ .coverChildren ()
340+ .childPadding (10 )
341+ .child (new FluidSlot ()
342+ .syncHandler (new FluidSlotSyncHandler (waterTank .getStorages ()[0 ]))
343+ .size (14 , 54 )
344+ .displayAmount (false ))
345+ .child (new FluidSlot ()
346+ .syncHandler (new FluidSlotSyncHandler (steamTank .getStorages ()[0 ])
347+ .canFillSlot (false ).canDrainSlot (true ))
348+ .alwaysShowFull (true )
349+ .size (14 , 54 )
350+ .displayAmount (false ))
351+ .child (new ProgressWidget ()
352+ .texture (progressTexture ,
353+ GTGuiTextures .PROGRESS_BAR_BOILER_HEAT , 54 )
354+ .size (14 , 54 )
355+ .progress (this ::getTemperaturePercent )
356+ .direction (ProgressWidget .Direction .UP )
357+ .tooltipAutoUpdate (true )
358+ .tooltipBuilder ((r ) -> r .addLine (IKey
359+ .lang (Component .translatable ("gtceu.fluid.temperature" , getCurrentTemperature ()))))))
360+ .child (SlotGroupWidget .playerInventory (false ).bottom (7 ).left (7 ));
361+
362+ return panel ;
339363 }
340364
365+ /*
366+ * @Override
367+ * public ModularUI createUI(Player entityPlayer) {
368+ * return new ModularUI(176, 166, this, entityPlayer)
369+ * .background(GuiTextures.BACKGROUND_STEAM.get(isHighPressure))
370+ * .widget(new LabelWidget(6, 6, getBlockState().getBlock().getDescriptionId()))
371+ * .widget(new ProgressWidget(this::getTemperaturePercent, 96, 26, 10, 54)
372+ * .setProgressTexture(GuiTextures.PROGRESS_BAR_BOILER_EMPTY.get(isHighPressure),
373+ * GuiTextures.PROGRESS_BAR_BOILER_HEAT)
374+ * .setFillDirection(ProgressTexture.FillDirection.DOWN_TO_UP)
375+ * .setDynamicHoverTips(pct -> I18n.get("gtceu.multiblock.large_boiler.temperature",
376+ * currentTemperature + 274, getMaxTemperature() + 274)))
377+ * .widget(new TankWidget(waterTank.getStorages()[0], 83, 26, 10, 54, false, true)
378+ * .setShowAmount(false)
379+ * .setFillDirection(ProgressTexture.FillDirection.DOWN_TO_UP)
380+ * .setBackground(GuiTextures.PROGRESS_BAR_BOILER_EMPTY.get(isHighPressure)))
381+ * .widget(new TankWidget(steamTank.getStorages()[0], 70, 26, 10, 54, true, false)
382+ * .setShowAmount(false)
383+ * .setFillDirection(ProgressTexture.FillDirection.DOWN_TO_UP)
384+ * .setBackground(GuiTextures.PROGRESS_BAR_BOILER_EMPTY.get(isHighPressure)))
385+ * .widget(new ImageWidget(43, 44, 18, 18, GuiTextures.CANISTER_OVERLAY_STEAM.get(isHighPressure)))
386+ * .widget(UITemplate.bindPlayerInventory(entityPlayer.getInventory(),
387+ * GuiTextures.SLOT_STEAM.get(isHighPressure), 7, 84, true));
388+ * }
389+ */
390+
341391 //////////////////////////////////////
342392 // ********* Client *********//
343393 //////////////////////////////////////
0 commit comments