Skip to content

Commit a576d8c

Browse files
committed
update filter max transfer size on popup open
make fluid slot tooltip always update fix popup not closing in certain situations
1 parent 76889b3 commit a576d8c

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/main/java/gregtech/common/covers/filter/BaseFilterContainer.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,10 @@ public void handleLegacyNBT(NBTTagCompound nbt) {
213213
/** Uses Cleanroom MUI */
214214
public IWidget initUI(GuiData data, PanelSyncManager manager) {
215215
IPanelHandler panel = manager.panel("filter_panel", (syncManager, syncHandler) -> {
216-
var filter = hasFilter() ? getFilter() : BaseFilter.ERROR_FILTER;
217-
filter.setMaxTransferSize(getMaxTransferSize());
218-
return filter.createPopupPanel(syncManager);
216+
if (hasFilter()) {
217+
return getFilter().createPopupPanel(syncManager);
218+
}
219+
return BaseFilter.ERROR_FILTER.createPopupPanel(syncManager);
219220
}, true);
220221

221222
return Flow.row().coverChildrenHeight()
@@ -225,7 +226,7 @@ public IWidget initUI(GuiData data, PanelSyncManager manager) {
225226
.filter(this::isItemValid)
226227
.singletonSlotGroup(101)
227228
.changeListener((newItem, onlyAmountChanged, client, init) -> {
228-
if (!isItemValid(newItem) && panel.isPanelOpen()) {
229+
if (!isItemValid(newItem) || (newItem.isEmpty() && panel.isPanelOpen())) {
229230
panel.closePanel();
230231
}
231232
}))
@@ -238,6 +239,7 @@ public IWidget initUI(GuiData data, PanelSyncManager manager) {
238239
.setEnabledIf(w -> hasFilter())
239240
.onMousePressed(i -> {
240241
if (!panel.isPanelOpen()) {
242+
setMaxTransferSize(getMaxTransferSize());
241243
panel.openPanel();
242244
} else {
243245
panel.closePanel();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public final class GTFluidSlot extends Widget<GTFluidSlot> implements Interactab
3636

3737
public GTFluidSlot() {
3838
tooltip().titleMargin();
39+
tooltipAutoUpdate(true);
3940
tooltipBuilder(tooltip -> {
4041
if (isSynced()) {
4142
syncHandler.handleTooltip(tooltip);
@@ -63,7 +64,6 @@ public GTFluidSlot syncHandler(IFluidTank fluidTank) {
6364

6465
public GTFluidSlot syncHandler(GTFluidSyncHandler syncHandler) {
6566
setSyncHandler(syncHandler);
66-
syncHandler.setChangeConsumer($ -> markTooltipDirty());
6767
return this;
6868
}
6969

0 commit comments

Comments
 (0)