Skip to content

Commit bebb626

Browse files
committed
fix more things from rebase
don't show amounts for quantum fluid tanks show tooltip for quantum item move booleans to supplier delete unused class
1 parent aaee4d4 commit bebb626

File tree

6 files changed

+19
-78
lines changed

6 files changed

+19
-78
lines changed

src/main/java/gregtech/api/mui/sync/GTItemSyncHandler.java

Lines changed: 0 additions & 67 deletions
This file was deleted.

src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeChest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager)
127127
active = value;
128128
scheduleRenderUpdate();
129129
var c = getQuantumController();
130-
if (c != null) c.updateHandler();
130+
if (c != null) c.onHandlerUpdate();
131131
})))
132132
.child(new ItemSlot()
133133
.slot(SyncHandlers.phantomItemSlot(handler, 0)

src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityCreativeTank.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager)
9999
.child(new GTFluidSlot()
100100
.syncHandler(GTFluidSlot.sync(this.fluidTank)
101101
.phantom(true)
102-
.showAmountInTooltip(true)
103-
.showAmountOnSlot(true))
102+
.showAmount(false, false))
104103
.pos(36, 6))
105104
.child(Flow.column()
106105
.pos(7, 28)
@@ -133,7 +132,7 @@ public ModularPanel buildUI(PosGuiData guiData, PanelSyncManager guiSyncManager)
133132
active = value;
134133
scheduleRenderUpdate();
135134
var c = getQuantumController();
136-
if (c != null) c.updateHandler();
135+
if (c != null) c.onHandlerUpdate();
137136
})))
138137
.child(createConnectionButton()
139138
.top(6));

src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumChest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ protected void createWidgets(ModularPanel mainPanel, PanelSyncManager syncManage
318318
textWidget -> !virtualItemStack.isEmpty(),
319319
() -> TextFormattingUtil.formatNumbers(itemsStoredInside)))
320320
.child(new GTItemSlot()
321-
.showTooltip(false)
321+
.showTooltip(true)
322322
.showAmount(false)
323323
.background(IDrawable.NONE)
324324
.slot(new ModularSlot(itemInventory, 0)

src/main/java/gregtech/common/metatileentities/storage/MetaTileEntityQuantumTank.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,7 @@ protected void createWidgets(ModularPanel mainPanel, PanelSyncManager syncManage
324324
setLocked(fluidStack != null);
325325
lockedFluid = fluidStack;
326326
}, this::setLocked)
327-
.showAmountOnSlot(true)
328-
.showAmountInTooltip(true))
327+
.showAmount(false, false))
329328
.pos(148, 41));
330329
}
331330

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

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,14 @@
2727
import org.jetbrains.annotations.NotNull;
2828
import org.jetbrains.annotations.Nullable;
2929

30+
import java.util.function.BooleanSupplier;
31+
3032
public class GTItemSlot extends Widget<GTItemSlot>
3133
implements IVanillaSlot, Interactable, JeiGhostIngredientSlot<ItemStack>,
3234
JeiIngredientProvider {
3335

34-
private boolean showTooltip = true;
35-
private boolean showAmount = true;
36+
private BooleanSupplier showTooltip = () -> true;
37+
private BooleanSupplier showAmount = () -> true;
3638
private ItemSlotSH syncHandler;
3739

3840
public GTItemSlot() {
@@ -56,11 +58,19 @@ public void onInit() {
5658
}
5759

5860
public GTItemSlot showTooltip(boolean showTooltip) {
61+
return showTooltip(() -> showTooltip);
62+
}
63+
64+
public GTItemSlot showTooltip(BooleanSupplier showTooltip) {
5965
this.showTooltip = showTooltip;
6066
return getThis();
6167
}
6268

6369
public GTItemSlot showAmount(boolean showAmount) {
70+
return showAmount(() -> showAmount);
71+
}
72+
73+
public GTItemSlot showAmount(BooleanSupplier showAmount) {
6474
this.showAmount = showAmount;
6575
return getThis();
6676
}
@@ -128,7 +138,7 @@ public void onUpdate() {
128138
@Override
129139
public void drawForeground(ModularGuiContext context) {
130140
RichTooltip tooltip = getTooltip();
131-
if (showTooltip && tooltip != null && isHoveringFor(tooltip.getShowUpTimer())) {
141+
if (showTooltip.getAsBoolean() && tooltip != null && isHoveringFor(tooltip.getShowUpTimer())) {
132142
tooltip.draw(getContext(), getSlot().getStack());
133143
}
134144
}
@@ -137,7 +147,7 @@ public void drawForeground(ModularGuiContext context) {
137147
public void draw(ModularGuiContext context, WidgetTheme widgetTheme) {
138148
if (this.syncHandler == null) return;
139149

140-
RenderUtil.drawItemStack(getSlot().getStack(), 1, 1, showAmount);
150+
RenderUtil.drawItemStack(getSlot().getStack(), 1, 1, showAmount.getAsBoolean());
141151

142152
if (isHovering()) {
143153
GlStateManager.colorMask(true, true, true, false);

0 commit comments

Comments
 (0)