From 3b4c2b1dec40a1347ee181752a689113c29c6699 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20N=C3=BCcke?= Date: Sun, 10 Jan 2021 16:24:55 +0100 Subject: [PATCH] Make computer emit block update after bus scan finishes. Necessary because this may lead to newly available capabilities from new devices. --- .../li/cil/oc2/common/tileentity/ComputerTileEntity.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/li/cil/oc2/common/tileentity/ComputerTileEntity.java b/src/main/java/li/cil/oc2/common/tileentity/ComputerTileEntity.java index 983327d6..e6c42394 100644 --- a/src/main/java/li/cil/oc2/common/tileentity/ComputerTileEntity.java +++ b/src/main/java/li/cil/oc2/common/tileentity/ComputerTileEntity.java @@ -311,12 +311,19 @@ public final class ComputerTileEntity extends AbstractTileEntity implements ITic world.notifyNeighborsOfStateChange(getPos(), getBlockState().getBlock()); } + final AbstractDeviceBusController.BusState oldBusState = busController.getState(); busController.scan(); setBusState(busController.getState()); if (busState != AbstractDeviceBusController.BusState.READY) { return; } + if (oldBusState != AbstractDeviceBusController.BusState.READY) { + // Bus just became ready, meaning new devices may be available, meaning new + // capabilities may be available, so we need to tell our neighbors. + world.notifyNeighborsOfStateChange(getPos(), getBlockState().getBlock()); + } + switch (runState) { case STOPPED: break;