Skip to content

Commit 56bf457

Browse files
committed
make power into overlay
title margin for GTFluidSlot work on multiblock tank slot
1 parent 3579f00 commit 56bf457

File tree

5 files changed

+26
-33
lines changed

5 files changed

+26
-33
lines changed

src/main/java/gregtech/api/metatileentity/multiblock/ui/MultiblockUIFactory.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import com.cleanroommc.modularui.factory.PosGuiData;
2424
import com.cleanroommc.modularui.screen.ModularPanel;
2525
import com.cleanroommc.modularui.utils.Alignment;
26-
import com.cleanroommc.modularui.value.BoolValue;
2726
import com.cleanroommc.modularui.value.sync.BooleanSyncValue;
2827
import com.cleanroommc.modularui.value.sync.IntSyncValue;
2928
import com.cleanroommc.modularui.value.sync.PanelSyncManager;
@@ -365,11 +364,8 @@ protected Flow createButtons(@NotNull ModularPanel mainPanel, @NotNull PanelSync
365364
protected IWidget createDistinctButton(@NotNull ModularPanel mainPanel,
366365
@NotNull PanelSyncManager panelSyncManager) {
367366
if (!(mte instanceof IDistinctBusController distinct) || !distinct.canBeDistinct()) {
368-
return new ToggleButton()
367+
return new ButtonWidget<>()
369368
.size(18)
370-
.disableHoverOverlay()
371-
.disableHoverBackground()
372-
.value(new BoolValue.Dynamic(() -> false, b -> {}))
373369
.overlay(GTGuiTextures.OVERLAY_DISTINCT_BUSES[0])
374370
.addTooltipLine(IKey.lang("gregtech.multiblock.universal.distinct_not_supported"));
375371
}

src/main/java/gregtech/api/mui/GTGuiTextures.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,11 @@ private static String id(String path) {
273273
"textures/gui/primitive/overlay_primitive_dust.png");
274274
public static final UITexture PRIMITIVE_INGOT_OVERLAY = fullImage(
275275
"textures/gui/primitive/overlay_primitive_ingot.png");
276-
public static final UITexture PRIMITIVE_LARGE_FLUID_TANK = fullImage(
277-
"textures/gui/primitive/primitive_large_fluid_tank.png");
276+
public static final UITexture PRIMITIVE_LARGE_FLUID_TANK = new UITexture.Builder()
277+
.location(GTValues.MODID, "textures/gui/primitive/primitive_large_fluid_tank.png")
278+
.fullImage()
279+
.adaptable(2)
280+
.build();
278281
public static final UITexture PRIMITIVE_LARGE_FLUID_TANK_OVERLAY = fullImage(
279282
"textures/gui/primitive/primitive_large_fluid_tank_overlay.png");
280283
public static final UITexture PRIMITIVE_BLAST_FURNACE_PROGRESS_BAR = fullImage(

src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityMultiblockTank.java

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import gregtech.api.metatileentity.multiblock.ui.MultiblockUIFactory;
1111
import gregtech.api.mui.GTGuiTextures;
1212
import gregtech.api.mui.GTGuiTheme;
13-
import gregtech.api.mui.GTGuis;
1413
import gregtech.api.pattern.BlockPattern;
1514
import gregtech.api.pattern.FactoryBlockPattern;
1615
import gregtech.client.renderer.ICubeRenderer;
@@ -39,9 +38,7 @@
3938
import codechicken.lib.render.pipeline.IVertexOperation;
4039
import codechicken.lib.vec.Matrix4;
4140
import com.cleanroommc.modularui.api.drawable.IKey;
42-
import com.cleanroommc.modularui.factory.PosGuiData;
43-
import com.cleanroommc.modularui.screen.ModularPanel;
44-
import com.cleanroommc.modularui.value.sync.PanelSyncManager;
41+
import com.cleanroommc.modularui.utils.Alignment;
4542
import com.cleanroommc.modularui.widgets.TextWidget;
4643
import org.jetbrains.annotations.NotNull;
4744
import org.jetbrains.annotations.Nullable;
@@ -142,26 +139,24 @@ protected boolean openGUIOnRightClick() {
142139

143140
@Override
144141
protected MultiblockUIFactory createUIFactory() {
145-
return new MultiblockUIFactory(this) {
146-
147-
@Override
148-
public @NotNull ModularPanel buildUI(PosGuiData guiData, PanelSyncManager panelSyncManager) {
149-
var panel = GTGuis.createPanel(MetaTileEntityMultiblockTank.this, 176, 166);
150-
151-
panel.child(new TextWidget(IKey.lang(getMetaFullName()))
152-
.pos(5, 5));
153-
panel.child(new GTFluidSlot()
154-
.pos(52, 18)
155-
.size(72, 61)
156-
.background(GTGuiTextures.SLOT)
157-
.syncHandler(GTFluidSlot.sync(importFluids.getTankAt(0))
158-
.showAmountOnSlot(false)
159-
.drawAlwaysFull(false)));
160-
panel.bindPlayerInventory();
161-
162-
return panel;
163-
}
164-
};
142+
return new MultiblockUIFactory(this)
143+
.setSize(176, 166)
144+
.disableDisplay()
145+
.disableButtons()
146+
.addScreenChildren((parent, syncManager) -> {
147+
parent.child(new TextWidget(IKey.lang(getMetaFullName()))
148+
.pos(5, 5));
149+
parent.child(new GTFluidSlot()
150+
.pos(52, 18)
151+
.size(72, 61)
152+
// todo this looks ugly
153+
.overlay(GTGuiTextures.PRIMITIVE_LARGE_FLUID_TANK_OVERLAY.asIcon()
154+
.alignment(Alignment.CenterLeft)
155+
.size(30, 58))
156+
.syncHandler(GTFluidSlot.sync(importFluids.getTankAt(0))
157+
.showAmountOnSlot(false)
158+
.drawAlwaysFull(false)));
159+
});
165160
}
166161

167162
@Override

src/main/java/gregtech/common/mui/widget/GTFluidSlot.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ public final class GTFluidSlot extends Widget<GTFluidSlot> implements Interactab
4444
private boolean disableBackground = false;
4545

4646
public GTFluidSlot() {
47-
tooltip().setAutoUpdate(true);
48-
// .setHasTitleMargin(true);
47+
tooltip().setAutoUpdate(true).titleMargin();
4948
tooltipBuilder(tooltip -> {
5049
if (!isSynced()) return;
5150
var fluid = this.syncHandler.getFluid();
-1.22 KB
Loading

0 commit comments

Comments
 (0)