Search in sources :

Example 1 with CCDirectCall

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());
    });
}
Also used : Arrays(java.util.Arrays) OrientationsUtil(logisticspipes.utils.OrientationsUtil) IRequireReliableFluidTransport(logisticspipes.interfaces.routing.IRequireReliableFluidTransport) IOrderInfoProvider(logisticspipes.routing.order.IOrderInfoProvider) MainProxy(logisticspipes.proxy.MainProxy) ILogisticsPowerProvider(logisticspipes.api.ILogisticsPowerProvider) Configs(logisticspipes.config.Configs) SinkReply(logisticspipes.utils.SinkReply) PipeController(logisticspipes.network.guis.pipe.PipeController) Map(java.util.Map) TransportLayer(logisticspipes.logisticspipes.TransportLayer) LogisticsRenderPipe(logisticspipes.renderer.LogisticsRenderPipe) LogisticsSecurityTileEntity(logisticspipes.blocks.LogisticsSecurityTileEntity) DebugLogController(logisticspipes.pipes.basic.debug.DebugLogController) NewGuiHandler(logisticspipes.network.NewGuiHandler) ILPPositionProvider(logisticspipes.interfaces.ILPPositionProvider) ModulePositionType(logisticspipes.modules.abstractmodules.LogisticsModule.ModulePositionType) CCConstants(logisticspipes.proxy.cc.CCConstants) LogisticsOrderManager(logisticspipes.routing.order.LogisticsOrderManager) PipeSignTypes(logisticspipes.network.packets.pipe.PipeSignTypes) CacheHolder(logisticspipes.utils.CacheHolder) LogisticsGuiModule(logisticspipes.modules.abstractmodules.LogisticsGuiModule) Set(java.util.Set) PacketHandler(logisticspipes.network.PacketHandler) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) ExitRoute(logisticspipes.routing.ExitRoute) ISecurityProvider(logisticspipes.interfaces.ISecurityProvider) SimpleServiceLocator(logisticspipes.proxy.SimpleServiceLocator) IFilter(logisticspipes.interfaces.routing.IFilter) IClientState(logisticspipes.interfaces.IClientState) ParticleFX(logisticspipes.network.packets.pipe.ParticleFX) PipeFXRenderHandler(logisticspipes.pipefxhandlers.PipeFXRenderHandler) FluidStack(net.minecraftforge.fluids.FluidStack) ModDependentMethod(logisticspipes.asm.ModDependentMethod) ITrackStatistics(logisticspipes.logisticspipes.ITrackStatistics) ArrayList(java.util.ArrayList) StatUpdate(logisticspipes.network.packets.pipe.StatUpdate) UpgradeManager(logisticspipes.pipes.upgrades.UpgradeManager) ItemStack(net.minecraft.item.ItemStack) ISubSystemPowerProvider(logisticspipes.interfaces.ISubSystemPowerProvider) StatusEntry(logisticspipes.pipes.basic.debug.StatusEntry) IWorldProvider(logisticspipes.interfaces.IWorldProvider) LogisticsItemOrderManager(logisticspipes.routing.order.LogisticsItemOrderManager) World(net.minecraft.world.World) SecuritySettings(logisticspipes.security.SecuritySettings) IPipeUpgradeManager(logisticspipes.interfaces.IPipeUpgradeManager) TreeMap(java.util.TreeMap) ItemIdentifierStack(logisticspipes.utils.item.ItemIdentifierStack) IWatchingHandler(logisticspipes.interfaces.IWatchingHandler) PipeTransportLayer(logisticspipes.logisticspipes.PipeTransportLayer) TileEntity(net.minecraft.tileentity.TileEntity) IRoutedItem(logisticspipes.logisticspipes.IRoutedItem) IRouter(logisticspipes.routing.IRouter) LogisticsModule(logisticspipes.modules.abstractmodules.LogisticsModule) Textures(logisticspipes.textures.Textures) Item(net.minecraft.item.Item) LogisticsPipes(logisticspipes.LogisticsPipes) Particles(logisticspipes.pipefxhandlers.Particles) Random(java.util.Random) CCType(logisticspipes.proxy.computers.interfaces.CCType) PlayerCollectionList(logisticspipes.utils.PlayerCollectionList) PriorityBlockingQueue(java.util.concurrent.PriorityBlockingQueue) IRequireReliableTransport(logisticspipes.interfaces.routing.IRequireReliableTransport) NBTTagList(net.minecraft.nbt.NBTTagList) FluidIdentifier(logisticspipes.utils.FluidIdentifier) SidedInventoryMinecraftAdapter(logisticspipes.utils.SidedInventoryMinecraftAdapter) CCCommand(logisticspipes.proxy.computers.interfaces.CCCommand) ILPTEInformation(logisticspipes.asm.te.ILPTEInformation) IAdditionalTargetInformation(logisticspipes.interfaces.routing.IAdditionalTargetInformation) IQueueCCEvent(logisticspipes.interfaces.IQueueCCEvent) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) ModernPacket(logisticspipes.network.abstractpackets.ModernPacket) ConnectionPipeType(logisticspipes.routing.pathfinder.IPipeInformationProvider.ConnectionPipeType) ItemIdentifier(logisticspipes.utils.item.ItemIdentifier) RouteLayer(logisticspipes.logisticspipes.RouteLayer) Triplet(logisticspipes.utils.tuples.Triplet) UUID(java.util.UUID) IHighlightPlacementRenderer(logisticspipes.renderer.newpipe.IHighlightPlacementRenderer) LPDataOutput(network.rs485.logisticspipes.util.LPDataOutput) Collectors(java.util.stream.Collectors) TransportMode(logisticspipes.logisticspipes.IRoutedItem.TransportMode) ServerRouter(logisticspipes.routing.ServerRouter) DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates) ItemPipeSignCreator(logisticspipes.items.ItemPipeSignCreator) List(java.util.List) IInventoryUtil(logisticspipes.interfaces.IInventoryUtil) EntityPlayer(net.minecraft.entity.player.EntityPlayer) Pair(logisticspipes.utils.tuples.Pair) Entry(java.util.Map.Entry) Queue(java.util.Queue) GuiIDs(logisticspipes.network.GuiIDs) IPipeSign(logisticspipes.pipes.signs.IPipeSign) WorldCoordinatesWrapper(network.rs485.logisticspipes.world.WorldCoordinatesWrapper) Getter(lombok.Getter) CCSecurtiyCheck(logisticspipes.proxy.computers.interfaces.CCSecurtiyCheck) IPipeServiceProvider(logisticspipes.interfaces.IPipeServiceProvider) RequestSignPacket(logisticspipes.network.packets.pipe.RequestSignPacket) PermissionException(logisticspipes.security.PermissionException) CrashReportCategory(net.minecraft.crash.CrashReportCategory) Minecraft(net.minecraft.client.Minecraft) IRequestItems(logisticspipes.interfaces.routing.IRequestItems) ISlotUpgradeManager(logisticspipes.interfaces.ISlotUpgradeManager) ExtractionMode(logisticspipes.logisticspipes.ExtractionMode) ItemRoutingInformation(logisticspipes.routing.ItemRoutingInformation) LPTravelingItemServer(logisticspipes.transport.LPTravelingItem.LPTravelingItemServer) LinkedList(java.util.LinkedList) LPConstants(logisticspipes.LPConstants) InventoryHelper(logisticspipes.utils.InventoryHelper) LPDataInput(network.rs485.logisticspipes.util.LPDataInput) CCDirectCall(logisticspipes.proxy.computers.interfaces.CCDirectCall) TextureType(logisticspipes.textures.Textures.TextureType) PipeTransportLogistics(logisticspipes.transport.PipeTransportLogistics) IInventory(net.minecraft.inventory.IInventory) ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation) BitSet(java.util.BitSet) Collections(java.util.Collections) BitSet(java.util.BitSet) CCCommand(logisticspipes.proxy.computers.interfaces.CCCommand) CCDirectCall(logisticspipes.proxy.computers.interfaces.CCDirectCall)

Example 2 with CCDirectCall

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;
}
Also used : PermissionException(logisticspipes.security.PermissionException) IRouter(logisticspipes.routing.IRouter) UUID(java.util.UUID) ModDependentMethod(logisticspipes.asm.ModDependentMethod) CCCommand(logisticspipes.proxy.computers.interfaces.CCCommand) CCDirectCall(logisticspipes.proxy.computers.interfaces.CCDirectCall)

Example 3 with CCDirectCall

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());
    });
}
Also used : Arrays(java.util.Arrays) OrientationsUtil(logisticspipes.utils.OrientationsUtil) IRequireReliableFluidTransport(logisticspipes.interfaces.routing.IRequireReliableFluidTransport) IOrderInfoProvider(logisticspipes.routing.order.IOrderInfoProvider) MainProxy(logisticspipes.proxy.MainProxy) ILogisticsPowerProvider(logisticspipes.api.ILogisticsPowerProvider) Configs(logisticspipes.config.Configs) SinkReply(logisticspipes.utils.SinkReply) PipeController(logisticspipes.network.guis.pipe.PipeController) Map(java.util.Map) TransportLayer(logisticspipes.logisticspipes.TransportLayer) LogisticsRenderPipe(logisticspipes.renderer.LogisticsRenderPipe) LogisticsSecurityTileEntity(logisticspipes.blocks.LogisticsSecurityTileEntity) DebugLogController(logisticspipes.pipes.basic.debug.DebugLogController) NewGuiHandler(logisticspipes.network.NewGuiHandler) ILPPositionProvider(logisticspipes.interfaces.ILPPositionProvider) ModulePositionType(logisticspipes.modules.abstractmodules.LogisticsModule.ModulePositionType) CCConstants(logisticspipes.proxy.cc.CCConstants) LogisticsOrderManager(logisticspipes.routing.order.LogisticsOrderManager) PipeSignTypes(logisticspipes.network.packets.pipe.PipeSignTypes) CacheHolder(logisticspipes.utils.CacheHolder) LogisticsGuiModule(logisticspipes.modules.abstractmodules.LogisticsGuiModule) Set(java.util.Set) PacketHandler(logisticspipes.network.PacketHandler) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) ExitRoute(logisticspipes.routing.ExitRoute) ISecurityProvider(logisticspipes.interfaces.ISecurityProvider) SimpleServiceLocator(logisticspipes.proxy.SimpleServiceLocator) IFilter(logisticspipes.interfaces.routing.IFilter) IClientState(logisticspipes.interfaces.IClientState) ParticleFX(logisticspipes.network.packets.pipe.ParticleFX) PipeFXRenderHandler(logisticspipes.pipefxhandlers.PipeFXRenderHandler) FluidStack(net.minecraftforge.fluids.FluidStack) ModDependentMethod(logisticspipes.asm.ModDependentMethod) ITrackStatistics(logisticspipes.logisticspipes.ITrackStatistics) ArrayList(java.util.ArrayList) StatUpdate(logisticspipes.network.packets.pipe.StatUpdate) UpgradeManager(logisticspipes.pipes.upgrades.UpgradeManager) ItemStack(net.minecraft.item.ItemStack) ISubSystemPowerProvider(logisticspipes.interfaces.ISubSystemPowerProvider) StatusEntry(logisticspipes.pipes.basic.debug.StatusEntry) IWorldProvider(logisticspipes.interfaces.IWorldProvider) LogisticsItemOrderManager(logisticspipes.routing.order.LogisticsItemOrderManager) World(net.minecraft.world.World) SecuritySettings(logisticspipes.security.SecuritySettings) IPipeUpgradeManager(logisticspipes.interfaces.IPipeUpgradeManager) TreeMap(java.util.TreeMap) ItemIdentifierStack(logisticspipes.utils.item.ItemIdentifierStack) IWatchingHandler(logisticspipes.interfaces.IWatchingHandler) PipeTransportLayer(logisticspipes.logisticspipes.PipeTransportLayer) TileEntity(net.minecraft.tileentity.TileEntity) IRoutedItem(logisticspipes.logisticspipes.IRoutedItem) IRouter(logisticspipes.routing.IRouter) LogisticsModule(logisticspipes.modules.abstractmodules.LogisticsModule) Textures(logisticspipes.textures.Textures) Item(net.minecraft.item.Item) LogisticsPipes(logisticspipes.LogisticsPipes) Particles(logisticspipes.pipefxhandlers.Particles) Random(java.util.Random) CCType(logisticspipes.proxy.computers.interfaces.CCType) PlayerCollectionList(logisticspipes.utils.PlayerCollectionList) PriorityBlockingQueue(java.util.concurrent.PriorityBlockingQueue) IRequireReliableTransport(logisticspipes.interfaces.routing.IRequireReliableTransport) NBTTagList(net.minecraft.nbt.NBTTagList) FluidIdentifier(logisticspipes.utils.FluidIdentifier) SidedInventoryMinecraftAdapter(logisticspipes.utils.SidedInventoryMinecraftAdapter) CCCommand(logisticspipes.proxy.computers.interfaces.CCCommand) ILPTEInformation(logisticspipes.asm.te.ILPTEInformation) IAdditionalTargetInformation(logisticspipes.interfaces.routing.IAdditionalTargetInformation) IQueueCCEvent(logisticspipes.interfaces.IQueueCCEvent) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) ModernPacket(logisticspipes.network.abstractpackets.ModernPacket) ConnectionPipeType(logisticspipes.routing.pathfinder.IPipeInformationProvider.ConnectionPipeType) ItemIdentifier(logisticspipes.utils.item.ItemIdentifier) RouteLayer(logisticspipes.logisticspipes.RouteLayer) Triplet(logisticspipes.utils.tuples.Triplet) UUID(java.util.UUID) IHighlightPlacementRenderer(logisticspipes.renderer.newpipe.IHighlightPlacementRenderer) LPDataOutput(network.rs485.logisticspipes.util.LPDataOutput) Collectors(java.util.stream.Collectors) TransportMode(logisticspipes.logisticspipes.IRoutedItem.TransportMode) ServerRouter(logisticspipes.routing.ServerRouter) DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates) ItemPipeSignCreator(logisticspipes.items.ItemPipeSignCreator) List(java.util.List) IInventoryUtil(logisticspipes.interfaces.IInventoryUtil) EntityPlayer(net.minecraft.entity.player.EntityPlayer) Pair(logisticspipes.utils.tuples.Pair) Entry(java.util.Map.Entry) Queue(java.util.Queue) GuiIDs(logisticspipes.network.GuiIDs) IPipeSign(logisticspipes.pipes.signs.IPipeSign) WorldCoordinatesWrapper(network.rs485.logisticspipes.world.WorldCoordinatesWrapper) Getter(lombok.Getter) CCSecurtiyCheck(logisticspipes.proxy.computers.interfaces.CCSecurtiyCheck) IPipeServiceProvider(logisticspipes.interfaces.IPipeServiceProvider) RequestSignPacket(logisticspipes.network.packets.pipe.RequestSignPacket) PermissionException(logisticspipes.security.PermissionException) CrashReportCategory(net.minecraft.crash.CrashReportCategory) Minecraft(net.minecraft.client.Minecraft) IRequestItems(logisticspipes.interfaces.routing.IRequestItems) ISlotUpgradeManager(logisticspipes.interfaces.ISlotUpgradeManager) ExtractionMode(logisticspipes.logisticspipes.ExtractionMode) ItemRoutingInformation(logisticspipes.routing.ItemRoutingInformation) LPTravelingItemServer(logisticspipes.transport.LPTravelingItem.LPTravelingItemServer) LinkedList(java.util.LinkedList) LPConstants(logisticspipes.LPConstants) InventoryHelper(logisticspipes.utils.InventoryHelper) LPDataInput(network.rs485.logisticspipes.util.LPDataInput) CCDirectCall(logisticspipes.proxy.computers.interfaces.CCDirectCall) TextureType(logisticspipes.textures.Textures.TextureType) PipeTransportLogistics(logisticspipes.transport.PipeTransportLogistics) IInventory(net.minecraft.inventory.IInventory) ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation) BitSet(java.util.BitSet) Collections(java.util.Collections) BitSet(java.util.BitSet) CCCommand(logisticspipes.proxy.computers.interfaces.CCCommand) CCDirectCall(logisticspipes.proxy.computers.interfaces.CCDirectCall)

Aggregations

UUID (java.util.UUID)3 ModDependentMethod (logisticspipes.asm.ModDependentMethod)3 ArrayList (java.util.ArrayList)2 Arrays (java.util.Arrays)2 BitSet (java.util.BitSet)2 Collections (java.util.Collections)2 LinkedList (java.util.LinkedList)2 List (java.util.List)2 Map (java.util.Map)2 Entry (java.util.Map.Entry)2 Queue (java.util.Queue)2 Random (java.util.Random)2 Set (java.util.Set)2 TreeMap (java.util.TreeMap)2 PriorityBlockingQueue (java.util.concurrent.PriorityBlockingQueue)2 Collectors (java.util.stream.Collectors)2 LPConstants (logisticspipes.LPConstants)2 LogisticsPipes (logisticspipes.LogisticsPipes)2 ILogisticsPowerProvider (logisticspipes.api.ILogisticsPowerProvider)2 ILPTEInformation (logisticspipes.asm.te.ILPTEInformation)2