Fixed cable connectivity/scanning.
This commit is contained in:
@@ -69,9 +69,17 @@ public class BusCableTileEntity extends AbstractTileEntity {
|
||||
|
||||
@Override
|
||||
protected boolean canConnectToSide(final Direction direction) {
|
||||
return getConnectionType(direction) == BusCableBlock.ConnectionType.LINK;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasInterfaceOnSide(final Direction direction) {
|
||||
return getConnectionType(direction) == BusCableBlock.ConnectionType.PLUG;
|
||||
}
|
||||
|
||||
private BusCableBlock.ConnectionType getConnectionType(final Direction direction) {
|
||||
final EnumProperty<BusCableBlock.ConnectionType> property = BusCableBlock.FACING_TO_CONNECTION_MAP.get(direction);
|
||||
final BusCableBlock.ConnectionType connectionType = getBlockState().get(property);
|
||||
return connectionType == BusCableBlock.ConnectionType.PLUG;
|
||||
return getBlockState().get(property);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public class TileEntityDeviceBusElement extends AbstractGroupingBlockDeviceBusEl
|
||||
final int index = direction.getIndex();
|
||||
|
||||
final HashSet<BlockDeviceInfo> newDevices = new HashSet<>();
|
||||
if (canConnectToSide(direction)) {
|
||||
if (hasInterfaceOnSide(direction)) {
|
||||
for (final LazyOptional<BlockDeviceInfo> deviceInfo : Devices.getDevices(world, pos, direction)) {
|
||||
deviceInfo.ifPresent(newDevices::add);
|
||||
deviceInfo.addListener(unused -> handleNeighborChanged(pos));
|
||||
@@ -119,6 +119,10 @@ public class TileEntityDeviceBusElement extends AbstractGroupingBlockDeviceBusEl
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean hasInterfaceOnSide(final Direction direction) {
|
||||
return canConnectToSide(direction);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
private void scanNeighborsForDevices() {
|
||||
|
||||
Reference in New Issue
Block a user