Fixed Window not being set for Items of nested GUIs

This commit is contained in:
NichtStudioCode 2021-05-03 19:48:52 +02:00
parent dd80927b46
commit 01cff674f0

@ -77,14 +77,19 @@ public abstract class BaseWindow implements Window {
}
}
if (element != null) {
// tell the Item or VirtualInventory that it is being displayed in this Window
if (element instanceof ItemSlotElement) {
((ItemSlotElement) element).getItem().addWindow(this);
} else if (element instanceof VISlotElement) {
((VISlotElement) element).getVirtualInventory().addWindow(this);
SlotElement holdingElement = element.getHoldingElement();
if (holdingElement instanceof ItemSlotElement) {
((ItemSlotElement) holdingElement).getItem().addWindow(this);
} else if (holdingElement instanceof VISlotElement) {
((VISlotElement) holdingElement).getVirtualInventory().addWindow(this);
}
elementsDisplayed[index] = element;
elementsDisplayed[index] = holdingElement;
} else {
elementsDisplayed[index] = null;
}
}
}