Skip to content

Commit 572e51b

Browse files
committed
fix #153
1 parent 1d06e56 commit 572e51b

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

src/main/java/com/cleanroommc/modularui/screen/ClientScreenHandler.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,10 @@ public class ClientScreenHandler {
7979

8080
private static IMuiScreen lastMui;
8181

82-
public static boolean guiIsClosing;
83-
8482
// we need to know the actual gui and not some fake bs some other mod overwrites
8583
@SubscribeEvent(priority = EventPriority.LOWEST)
8684
public void onGuiOpen(GuiOpenEvent event) {
8785
GuiScreen newGui = event.getGui();
88-
guiIsClosing = newGui == null;
8986

9087
defaultContext.reset();
9188
if (lastMui != null && newGui == null) {

src/main/java/com/cleanroommc/modularui/value/sync/ModularSyncManager.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package com.cleanroommc.modularui.value.sync;
22

33
import com.cleanroommc.modularui.ModularUI;
4-
import com.cleanroommc.modularui.network.NetworkUtils;
5-
import com.cleanroommc.modularui.screen.ClientScreenHandler;
64
import com.cleanroommc.modularui.screen.ModularContainer;
75
import com.cleanroommc.modularui.widgets.slot.SlotGroup;
86
import com.cleanroommc.bogosorter.api.ISortingContextBuilder;
@@ -63,9 +61,7 @@ public void detectAndSendChanges(boolean init) {
6361
}
6462

6563
public void onClose() {
66-
if (NetworkUtils.isClient() && ClientScreenHandler.guiIsClosing) {
67-
this.panelSyncManagerMap.values().forEach(PanelSyncManager::onClose);
68-
}
64+
this.panelSyncManagerMap.values().forEach(PanelSyncManager::onClose);
6965
}
7066

7167
public void onOpen() {

src/main/java/com/cleanroommc/modularui/value/sync/PanelSyncManager.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@
2323
import org.jetbrains.annotations.NotNull;
2424

2525
import java.io.IOException;
26-
import java.util.*;
26+
import java.util.ArrayList;
27+
import java.util.Collection;
28+
import java.util.List;
29+
import java.util.Map;
30+
import java.util.Objects;
2731
import java.util.function.Consumer;
2832
import java.util.function.Supplier;
2933

@@ -90,10 +94,8 @@ public void onOpen() {
9094
@ApiStatus.Internal
9195
public void onClose() {
9296
this.closeListener.forEach(listener -> listener.accept(getPlayer()));
93-
for (String name : this.subPanels.keySet()) {
94-
SyncHandler sh = this.getModularSyncManager().getMainPSM().syncHandlers.remove(name);
95-
this.getModularSyncManager().getMainPSM().reverseSyncHandlers.remove(sh);
96-
}
97+
// previously panel sync handlers were removed from the main psm, however this problematic if the screen will be reopened at some
98+
// we can just not remove the sync handlers since mui has proper checks for re-registering panels
9799
}
98100

99101
public boolean isInitialised() {

0 commit comments

Comments
 (0)