Fixed drawer controllers not being aware of void drawer slot changes, closes #73
This commit is contained in:
parent
765631ea99
commit
2686143de3
|
@ -99,7 +99,13 @@ public abstract class ControllableDrawerTile<T extends ControllableDrawerTile<T>
|
||||||
}
|
}
|
||||||
this.addInventory((InventoryComponent<T>) (this.utilityUpgrades = new InventoryComponent<ControllableDrawerTile<T>>("utility_upgrades", 114, 70, 3)
|
this.addInventory((InventoryComponent<T>) (this.utilityUpgrades = new InventoryComponent<ControllableDrawerTile<T>>("utility_upgrades", 114, 70, 3)
|
||||||
.setInputFilter((stack, integer) -> stack.getItem() instanceof UpgradeItem && ((UpgradeItem) stack.getItem()).getType() == UpgradeItem.Type.UTILITY)
|
.setInputFilter((stack, integer) -> stack.getItem() instanceof UpgradeItem && ((UpgradeItem) stack.getItem()).getType() == UpgradeItem.Type.UTILITY)
|
||||||
.setSlotLimit(1))
|
.setSlotLimit(1)
|
||||||
|
.setOnSlotChanged((itemStack, integer) -> {
|
||||||
|
if (controllerPos != null && this.level.getBlockEntity(controllerPos) instanceof DrawerControllerTile controllerTile) {
|
||||||
|
controllerTile.getConnectedDrawers().rebuild();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,7 +214,7 @@ public class DrawerControllerTile extends ControllableDrawerTile<DrawerControlle
|
||||||
this.level = level;
|
this.level = level;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void rebuild() {
|
public void rebuild() {
|
||||||
this.handlers = new ArrayList<>();
|
this.handlers = new ArrayList<>();
|
||||||
if (level != null && !level.isClientSide()) {
|
if (level != null && !level.isClientSide()) {
|
||||||
for (Long connectedDrawer : this.connectedDrawers) {
|
for (Long connectedDrawer : this.connectedDrawers) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user