use of logisticspipes.proxy.computers.interfaces.CCDirectCall in project LogisticsPipes by RS485.
the class CoreRoutedPipe method sendMessage.
@CCCommand(description = "Sends a message to the givven computerId over the LP network. Event: " + CCConstants.LP_CC_MESSAGE_EVENT)
@CCDirectCall
public void sendMessage(final Double computerId, final Object message) {
int sourceId = -1;
if (container instanceof LogisticsTileGenericPipe) {
sourceId = SimpleServiceLocator.ccProxy.getLastCCID(container);
}
final int fSourceId = sourceId;
BitSet set = new BitSet(ServerRouter.getBiggestSimpleID());
getRouter().getIRoutersByCost().stream().filter(exit -> exit.destination != null && !set.get(exit.destination.getSimpleID())).forEach(exit -> {
exit.destination.queueTask(10, (pipe, router1) -> pipe.handleMesssage(computerId.intValue(), message, fSourceId));
set.set(exit.destination.getSimpleID());
});
}
use of logisticspipes.proxy.computers.interfaces.CCDirectCall in project LogisticsPipes by RS485.
the class CoreRoutedPipe method getPipeForUUID.
@CCCommand(description = "Returns the access to the pipe of the givven router UUID")
@ModDependentMethod(modId = LPConstants.computerCraftModID)
@CCDirectCall
public Object getPipeForUUID(String sUuid) throws PermissionException {
if (!getUpgradeManager().hasCCRemoteControlUpgrade()) {
throw new PermissionException();
}
UUID uuid = UUID.fromString(sUuid);
int id = SimpleServiceLocator.routerManager.getIDforUUID(uuid);
IRouter router = SimpleServiceLocator.routerManager.getRouter(id);
if (router == null) {
return null;
}
CoreRoutedPipe pipe = router.getPipe();
return pipe;
}
use of logisticspipes.proxy.computers.interfaces.CCDirectCall in project LogisticsPipes by RS485.
the class CoreRoutedPipe method sendBroadcast.
@CCCommand(description = "Sends a broadcast message to all Computer connected to this LP network. Event: " + CCConstants.LP_CC_BROADCAST_EVENT)
@CCDirectCall
public void sendBroadcast(final String message) {
int sourceId = -1;
if (container instanceof LogisticsTileGenericPipe) {
sourceId = SimpleServiceLocator.ccProxy.getLastCCID(container);
}
final int fSourceId = sourceId;
BitSet set = new BitSet(ServerRouter.getBiggestSimpleID());
getRouter().getIRoutersByCost().stream().filter(exit -> exit.destination != null && !set.get(exit.destination.getSimpleID())).forEach(exit -> {
exit.destination.queueTask(10, (pipe, router1) -> pipe.handleBroadcast(message, fSourceId));
set.set(exit.destination.getSimpleID());
});
}
Aggregations