Small rename.
This commit is contained in:
@@ -457,7 +457,7 @@ public final class ComputerTileEntity extends AbstractTileEntity implements ITic
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDevicesInvalid() {
|
||||
protected void onBeforeScan() {
|
||||
if (runState == RunState.RUNNING) {
|
||||
runState = RunState.LOADING_DEVICES;
|
||||
}
|
||||
@@ -466,7 +466,7 @@ public final class ComputerTileEntity extends AbstractTileEntity implements ITic
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDevicesValid(final boolean didDevicesChange) {
|
||||
protected void onAfterDeviceScan(final boolean didDevicesChange) {
|
||||
virtualMachine.rpcAdapter.resume(didDevicesChange);
|
||||
}
|
||||
|
||||
|
||||
@@ -61,15 +61,13 @@ public abstract class AbstractDeviceBusController implements DeviceBusController
|
||||
|
||||
@Override
|
||||
public void scheduleBusScan() {
|
||||
onDevicesInvalid();
|
||||
|
||||
scanDelay = 0; // scan as soon as possible
|
||||
state = BusState.SCAN_PENDING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scanDevices() {
|
||||
onDevicesInvalid();
|
||||
onBeforeScan();
|
||||
|
||||
final HashSet<Device> newDevices = new HashSet<>();
|
||||
final HashMap<Device, Set<UUID>> newDeviceIds = new HashMap<>();
|
||||
@@ -106,7 +104,7 @@ public abstract class AbstractDeviceBusController implements DeviceBusController
|
||||
deviceIds.putAll(newDeviceIds);
|
||||
}
|
||||
|
||||
onDevicesValid(didDevicesChange || didDeviceIdsChange);
|
||||
onAfterDeviceScan(didDevicesChange || didDeviceIdsChange);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -196,6 +194,8 @@ public abstract class AbstractDeviceBusController implements DeviceBusController
|
||||
optional.addListener(unused -> scheduleBusScan());
|
||||
}
|
||||
|
||||
onAfterBusScan();
|
||||
|
||||
scanDevices();
|
||||
|
||||
state = BusState.READY;
|
||||
@@ -203,10 +203,17 @@ public abstract class AbstractDeviceBusController implements DeviceBusController
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
protected void onDevicesInvalid() {
|
||||
protected Collection<DeviceBusElement> getElements() {
|
||||
return elements;
|
||||
}
|
||||
|
||||
protected void onDevicesValid(final boolean didDevicesChange) {
|
||||
protected void onAfterBusScan() {
|
||||
}
|
||||
|
||||
protected void onBeforeScan() {
|
||||
}
|
||||
|
||||
protected void onAfterDeviceScan(final boolean didDevicesChange) {
|
||||
}
|
||||
|
||||
protected void onDevicesAdded(final Collection<Device> devices) {
|
||||
|
||||
@@ -73,14 +73,6 @@ public class TileEntityDeviceBusElement extends AbstractGroupingBlockDeviceBusEl
|
||||
return Optional.of(neighbors);
|
||||
}
|
||||
|
||||
public boolean canConnectToSide(@Nullable final Direction direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean hasInterfaceOnSide(@Nullable final Direction direction) {
|
||||
return canConnectToSide(direction);
|
||||
}
|
||||
|
||||
public void handleNeighborChanged(final BlockPos pos) {
|
||||
final World world = tileEntity.getWorld();
|
||||
if (world == null || world.isRemote()) {
|
||||
@@ -124,6 +116,16 @@ public class TileEntityDeviceBusElement extends AbstractGroupingBlockDeviceBusEl
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
protected boolean canConnectToSide(@Nullable final Direction direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean hasInterfaceOnSide(@Nullable final Direction direction) {
|
||||
return canConnectToSide(direction);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
private void scanNeighborsForDevices() {
|
||||
for (final Direction direction : Direction.values()) {
|
||||
handleNeighborChanged(tileEntity.getPos().offset(direction));
|
||||
|
||||
Reference in New Issue
Block a user