|
10 | 10 | import gregtech.api.mui.widget.RecipeProgressWidget; |
11 | 11 | import gregtech.api.recipes.Recipe; |
12 | 12 | import gregtech.api.recipes.RecipeMap; |
| 13 | +import gregtech.common.mui.widget.GTFluidSlot; |
13 | 14 |
|
14 | 15 | import net.minecraftforge.items.IItemHandlerModifiable; |
15 | 16 |
|
|
19 | 20 | import com.cleanroommc.modularui.value.sync.PanelSyncManager; |
20 | 21 | import com.cleanroommc.modularui.value.sync.SyncHandlers; |
21 | 22 | import com.cleanroommc.modularui.widget.ParentWidget; |
22 | | -import com.cleanroommc.modularui.widget.Widget; |
23 | 23 | import com.cleanroommc.modularui.widget.sizer.Area; |
24 | | -import com.cleanroommc.modularui.widgets.FluidSlot; |
25 | 24 | import com.cleanroommc.modularui.widgets.ItemSlot; |
26 | 25 | import com.cleanroommc.modularui.widgets.ProgressWidget; |
27 | 26 | import com.cleanroommc.modularui.widgets.slot.SlotGroup; |
@@ -522,22 +521,22 @@ public ParentWidget<?> buildWidget(DoubleSupplier progressSupplier, IItemHandler |
522 | 521 | IItemHandlerModifiable exportItems, FluidTankList importFluids, |
523 | 522 | FluidTankList exportFluids, int yOffset, PanelSyncManager syncManager) { |
524 | 523 | DoubleSyncValue progressValue = new DoubleSyncValue(progressSupplier); |
525 | | - syncManager.syncValue("recipe_progress", progressValue); |
526 | 524 |
|
527 | 525 | ParentWidget<?> group = new ParentWidget<>().size(176, 166 + yOffset); |
528 | 526 | group.child(new RecipeProgressWidget() |
529 | 527 | .recipeMap(recipeMap) |
530 | 528 | .size(20) |
531 | 529 | .alignX(0.5f).top(23 + yOffset) |
532 | | - .progress(progressValue::getDoubleValue) |
| 530 | + .value(progressValue) |
533 | 531 | .texture(progressTexture, 20) |
534 | 532 | .direction(progressDirection)); |
535 | 533 | addInventorySlotGroup(group, importItems, importFluids, false, yOffset); |
536 | 534 | addInventorySlotGroup(group, exportItems, exportFluids, true, yOffset); |
537 | 535 | if (specialTextureNew != null) { |
538 | | - group.child(new Widget<>() |
539 | | - .flex(flex -> flex.getArea().set(specialTexturePosition)) |
540 | | - .background(specialTextureNew)); |
| 536 | + group.child(specialTextureNew.asWidget() |
| 537 | + .debugName("special_texture") |
| 538 | + .pos(specialTexturePosition.x(), specialTexturePosition.y()) |
| 539 | + .size(specialTexturePosition.w(), specialTexturePosition.h())); |
541 | 540 | } |
542 | 541 | return group; |
543 | 542 | } |
@@ -616,23 +615,23 @@ protected ItemSlot makeItemSlot(SlotGroup group, int x, int y, int slotIndex, II |
616 | 615 | .background(getOverlaysForSlotNew(isOutputs, false, slotIndex == itemHandler.getSlots() - 1)); |
617 | 616 | } |
618 | 617 |
|
619 | | - protected FluidSlot makeFluidSlot(int x, int y, int slotIndex, FluidTankList fluidHandler, boolean isOutputs) { |
620 | | - return new FluidSlot() |
621 | | - .syncHandler(SyncHandlers.fluidSlot(fluidHandler.getTankAt(slotIndex)) |
622 | | - .canFillSlot(!isOutputs)) |
623 | | - .alwaysShowFull(true) |
| 618 | + protected GTFluidSlot makeFluidSlot(int x, int y, int slotIndex, FluidTankList fluidHandler, boolean isOutputs) { |
| 619 | + return new GTFluidSlot() |
| 620 | + .syncHandler(GTFluidSlot.sync(fluidHandler.getTankAt(slotIndex)) |
| 621 | + .accessibility(true, !isOutputs)) |
| 622 | + // todo show always full, should be implemented with mui2 multis |
624 | 623 | .pos(x, y) |
625 | 624 | .background(getOverlaysForSlotNew(isOutputs, true, slotIndex == fluidHandler.getTanks() - 1)); |
626 | 625 | } |
627 | 626 |
|
628 | 627 | @ApiStatus.Experimental |
629 | | - protected IDrawable[] getOverlaysForSlotNew(boolean isOutput, boolean isFluid, boolean isLast) { |
| 628 | + protected IDrawable getOverlaysForSlotNew(boolean isOutput, boolean isFluid, boolean isLast) { |
630 | 629 | UITexture base = isFluid ? GTGuiTextures.FLUID_SLOT : GTGuiTextures.SLOT; |
631 | 630 | byte overlayKey = computeOverlayKey(isOutput, isFluid, isLast); |
632 | 631 | if (slotTextureOverlays.containsKey(overlayKey)) { |
633 | | - return new UITexture[] { base, slotTextureOverlays.get(overlayKey) }; |
| 632 | + return IDrawable.of(base, slotTextureOverlays.get(overlayKey)); |
634 | 633 | } |
635 | | - return new UITexture[] { base }; |
| 634 | + return IDrawable.of(base); |
636 | 635 | } |
637 | 636 |
|
638 | 637 | /** Marked experimental as this method will be removed when all GTCEu UIs are ported to MUI2. */ |
|
0 commit comments