Skip to content

Commit 85687f4

Browse files
authored
Close UIs of parts when they are removed from the world (#8615)
The issue causes dupe problems because the menu will interact with the "ghost" Part object which will no longer affect the world. Fixes #8614
1 parent 5390145 commit 85687f4

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/main/java/appeng/menu/AEBaseMenu.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
import appeng.menu.slot.DisabledSlot;
7979
import appeng.menu.slot.FakeSlot;
8080
import appeng.menu.slot.RestrictedInputSlot;
81+
import appeng.parts.AEBasePart;
8182
import appeng.util.ConfigMenuInventory;
8283

8384
public abstract class AEBaseMenu extends AbstractContainerMenu {
@@ -324,6 +325,12 @@ public void broadcastChanges() {
324325
&& this.blockEntity.getLevel().getBlockEntity(this.blockEntity.getBlockPos()) != this.blockEntity) {
325326
this.setValidMenu(false);
326327
}
328+
if (this.part instanceof AEBasePart basePart) {
329+
var host = basePart.getHost();
330+
if (host == null || !host.isInWorld() || host.getPart(basePart.getSide()) != basePart) {
331+
setValidMenu(false);
332+
}
333+
}
327334

328335
if (dataSync.hasChanges()) {
329336
sendPacketToClient(new GuiDataSyncPacket(containerId, dataSync::writeUpdate, registryAccess()));

0 commit comments

Comments
 (0)