Skip to content

Commit 53d0a2d

Browse files
committed
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 (cherry picked from commit 85687f4)
1 parent 9c87600 commit 53d0a2d

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
@@ -71,6 +71,7 @@
7171
import appeng.menu.slot.FakeSlot;
7272
import appeng.menu.slot.InaccessibleSlot;
7373
import appeng.menu.slot.RestrictedInputSlot;
74+
import appeng.parts.AEBasePart;
7475
import appeng.util.ConfigMenuInventory;
7576

7677
public abstract class AEBaseMenu extends AbstractContainerMenu {
@@ -309,6 +310,12 @@ public void broadcastChanges() {
309310
&& this.blockEntity.getLevel().getBlockEntity(this.blockEntity.getBlockPos()) != this.blockEntity) {
310311
this.setValidMenu(false);
311312
}
313+
if (this.part instanceof AEBasePart basePart) {
314+
var host = basePart.getHost();
315+
if (host == null || !host.isInWorld() || host.getPart(basePart.getSide()) != basePart) {
316+
setValidMenu(false);
317+
}
318+
}
312319

313320
if (dataSync.hasChanges()) {
314321
sendPacketToClient(new GuiDataSyncPacket(containerId, dataSync::writeUpdate));

0 commit comments

Comments
 (0)