use of mods.railcraft.api.electricity.IElectricGrid.ChargeHandler.ConnectType in project Trains-In-Motion-1.7.10 by EternalBlueFlame.
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<WorldCoordinate, EnumSet<ConnectType>> position : gridObject.getChargeHandler().getPossibleConnectionLocations().entrySet()) {
IElectricGrid otherObj = getGridObjectAt(gridObject.getTile().getWorldObj(), position.getKey());
if (otherObj != null && position.getValue().contains(otherObj.getChargeHandler().getType())) {
EnumSet<ConnectType> otherType = otherObj.getChargeHandler().getPossibleConnectionLocations().get(myPos);
if (otherType != null && otherType.contains(gridObject.getChargeHandler().getType()))
connectedObjects.add(otherObj);
}
}
return connectedObjects;
}
Aggregations