use of mods.railcraft.api.charge.IElectricGrid.ChargeHandler.ConnectType in project Railcraft by Railcraft.
the class GridTools method getMutuallyConnectedObjects.
public static Set<IElectricGrid> getMutuallyConnectedObjects(IElectricGrid gridObject) {
Set<IElectricGrid> connectedObjects = new HashSet<IElectricGrid>();
WorldCoordinate myPos = new WorldCoordinate(gridObject.getTile());
for (Map.Entry<BlockPos, EnumSet<ConnectType>> position : gridObject.getChargeHandler().getPossibleConnectionLocations().entrySet()) {
Optional<IElectricGrid> otherObj = getGridObjectAt(gridObject.getTile().getWorld(), position.getKey());
if (otherObj.isPresent() && position.getValue().contains(otherObj.get().getChargeHandler().getType())) {
EnumSet<ConnectType> otherType = otherObj.get().getChargeHandler().getPossibleConnectionLocations().get(myPos);
if (otherType != null && otherType.contains(gridObject.getChargeHandler().getType()))
connectedObjects.add(otherObj.get());
}
}
return connectedObjects;
}
Aggregations