Skip to content

Commit f6d8ae8

Browse files
Fix Buses not Auto Collapsing (GregTechCEu#1992)
1 parent a218e8e commit f6d8ae8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityItemBus.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ public void update() {
119119
}
120120
// Only attempt to auto collapse the inventory contents once the bus has been notified
121121
if (isAutoCollapse()) {
122-
IItemHandlerModifiable inventory = (isExportHatch ? this.getExportItems() : this.getImportItems());
122+
// Exclude the ghost circuit inventory from the auto collapse, so it does not extract any ghost circuits from the slot
123+
IItemHandlerModifiable inventory = (isExportHatch ? this.getExportItems() : super.getImportItems());
123124
if (isExportHatch ? this.getNotifiedItemOutputList().contains(inventory) : this.getNotifiedItemInputList().contains(inventory)) {
124125
collapseInventorySlotContents(inventory);
125126
}
@@ -360,6 +361,13 @@ public boolean isAutoCollapse() {
360361
public void setAutoCollapse(boolean inverted) {
361362
autoCollapse = inverted;
362363
if (!getWorld().isRemote) {
364+
if (autoCollapse) {
365+
if (isExportHatch) {
366+
addNotifiedOutput(this.getExportItems());
367+
} else {
368+
addNotifiedInput(super.getImportItems());
369+
}
370+
}
363371
writeCustomData(GregtechDataCodes.TOGGLE_COLLAPSE_ITEMS, packetBuffer -> packetBuffer.writeBoolean(autoCollapse));
364372
notifyBlockUpdate();
365373
markDirty();

0 commit comments

Comments
 (0)