Search in sources :

Example 1 with ChannelInformation

use of logisticspipes.routing.channels.ChannelInformation in project LogisticsPipes by RS485.

the class GuiSelectChannelPopup method actionPerformed.

@Override
protected void actionPerformed(GuiButton guibutton) throws IOException {
    if (guibutton.id == 0) {
        // Select
        int selected = textList.getSelected();
        if (selected >= 0) {
            ChannelInformation info = channelList.get(selected);
            if (info != null) {
                handleResult.accept(info);
            }
            exitGui();
        }
    } else {
        super.actionPerformed(guibutton);
    }
}
Also used : ChannelInformation(logisticspipes.routing.channels.ChannelInformation)

Example 2 with ChannelInformation

use of logisticspipes.routing.channels.ChannelInformation in project LogisticsPipes by RS485.

the class EditChannelPacket method processPacket.

@Override
public void processPacket(EntityPlayer player) {
    IChannelManager manager = SimpleServiceLocator.channelManagerProvider.getChannelManager(player.getEntityWorld());
    Optional<ChannelInformation> channelOpt = manager.getChannels().stream().filter(chan -> chan.getChannelIdentifier().equals(channelIdentifier)).findFirst();
    if (channelOpt.isPresent()) {
        ChannelInformation channel = channelOpt.get();
        if (!channel.getName().equals(getName())) {
            manager.updateChannelName(channelIdentifier, getName());
        }
        if (!channel.getRights().equals(getRights()) || (channel.getResponsibleSecurityID() != null && getSecurityStationID() != null && !channel.getResponsibleSecurityID().equals(getSecurityStationID())) || channel.getResponsibleSecurityID() != getSecurityStationID()) {
            manager.updateChannelRights(channelIdentifier, getRights(), getSecurityStationID());
        }
    }
}
Also used : ModernPacket(logisticspipes.network.abstractpackets.ModernPacket) Setter(lombok.Setter) SimpleServiceLocator(logisticspipes.proxy.SimpleServiceLocator) Getter(lombok.Getter) LPDataInput(network.rs485.logisticspipes.util.LPDataInput) EntityPlayer(net.minecraft.entity.player.EntityPlayer) IChannelManager(logisticspipes.interfaces.routing.IChannelManager) Optional(java.util.Optional) ChannelInformation(logisticspipes.routing.channels.ChannelInformation) StaticResolve(logisticspipes.utils.StaticResolve) UUID(java.util.UUID) LPDataOutput(network.rs485.logisticspipes.util.LPDataOutput) ChannelInformation(logisticspipes.routing.channels.ChannelInformation) IChannelManager(logisticspipes.interfaces.routing.IChannelManager)

Example 3 with ChannelInformation

use of logisticspipes.routing.channels.ChannelInformation in project LogisticsPipes by RS485.

the class OpenEditChannelGUIPacket method processPacket.

@Override
public void processPacket(EntityPlayer player) {
    TileEntity tile = player.getEntityWorld().getTileEntity(new BlockPos(getPosX(), getPosY(), getPosZ()));
    UUID securityID = null;
    if (tile instanceof LogisticsSecurityTileEntity) {
        LogisticsSecurityTileEntity security = (LogisticsSecurityTileEntity) tile;
        securityID = security.getSecId();
    }
    UUID finalSecurityID = securityID;
    IChannelManager channelManager = SimpleServiceLocator.channelManagerProvider.getChannelManager(player.getEntityWorld());
    Optional<ChannelInformation> match = channelManager.getChannels().stream().filter(channel -> channel.getChannelIdentifier().toString().equals(getIdentifier())).findFirst();
    match.ifPresent(channel -> NewGuiHandler.getGui(EditChannelGuiProvider.class).setResponsibleSecurityID(finalSecurityID).setChannel(channel).open(player));
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) LogisticsSecurityTileEntity(logisticspipes.blocks.LogisticsSecurityTileEntity) ModernPacket(logisticspipes.network.abstractpackets.ModernPacket) NewGuiHandler(logisticspipes.network.NewGuiHandler) Setter(lombok.Setter) Getter(lombok.Getter) LPDataInput(network.rs485.logisticspipes.util.LPDataInput) BlockPos(net.minecraft.util.math.BlockPos) UUID(java.util.UUID) LPDataOutput(network.rs485.logisticspipes.util.LPDataOutput) CoordinatesPacket(logisticspipes.network.abstractpackets.CoordinatesPacket) EditChannelGuiProvider(logisticspipes.network.guis.EditChannelGuiProvider) SimpleServiceLocator(logisticspipes.proxy.SimpleServiceLocator) EntityPlayer(net.minecraft.entity.player.EntityPlayer) IChannelManager(logisticspipes.interfaces.routing.IChannelManager) Optional(java.util.Optional) TileEntity(net.minecraft.tileentity.TileEntity) LogisticsSecurityTileEntity(logisticspipes.blocks.LogisticsSecurityTileEntity) ChannelInformation(logisticspipes.routing.channels.ChannelInformation) StaticResolve(logisticspipes.utils.StaticResolve) LogisticsSecurityTileEntity(logisticspipes.blocks.LogisticsSecurityTileEntity) ChannelInformation(logisticspipes.routing.channels.ChannelInformation) IChannelManager(logisticspipes.interfaces.routing.IChannelManager) BlockPos(net.minecraft.util.math.BlockPos) UUID(java.util.UUID)

Example 4 with ChannelInformation

use of logisticspipes.routing.channels.ChannelInformation in project LogisticsPipes by RS485.

the class PipeItemsInvSysConnector method guiOpenedByPlayer.

@Override
public void guiOpenedByPlayer(EntityPlayer player) {
    localGuiWatchers.add(player);
    MainProxy.sendPacketToPlayer(PacketHandler.getPacket(InvSysConResistance.class).setInteger(this.resistance).setBlockPos(this.getPos()), player);
    IChannelManager manager = SimpleServiceLocator.channelManagerProvider.getChannelManager(this.getWorld());
    Optional<ChannelInformation> channel = manager.getChannels().stream().filter(chan -> chan.getChannelIdentifier().equals(getConnectionUUID())).findFirst();
    channel.ifPresent(chan -> MainProxy.sendPacketToPlayer(PacketHandler.getPacket(ChannelInformationPacket.class).setInformation(chan).setTargeted(true), player));
}
Also used : HUDInvSysConnector(logisticspipes.gui.hud.HUDInvSysConnector) InvSysConGuiProvider(logisticspipes.network.guis.pipe.InvSysConGuiProvider) Textures(logisticspipes.textures.Textures) Item(net.minecraft.item.Item) Particles(logisticspipes.pipefxhandlers.Particles) MainProxy(logisticspipes.proxy.MainProxy) IHeadUpDisplayRenderer(logisticspipes.interfaces.IHeadUpDisplayRenderer) PlayerCollectionList(logisticspipes.utils.PlayerCollectionList) HUDStartWatchingPacket(logisticspipes.network.packets.hud.HUDStartWatchingPacket) LogisticsModule(logisticspipes.modules.LogisticsModule) Map(java.util.Map) TransportInvConnection(logisticspipes.transport.TransportInvConnection) LPNeighborTileEntityKt(network.rs485.logisticspipes.connection.LPNeighborTileEntityKt) ChannelInformationPacket(logisticspipes.network.packets.gui.ChannelInformationPacket) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) HUDStopWatchingPacket(logisticspipes.network.packets.hud.HUDStopWatchingPacket) NewGuiHandler(logisticspipes.network.NewGuiHandler) Collection(java.util.Collection) ItemIdentifier(logisticspipes.utils.item.ItemIdentifier) Set(java.util.Set) Triplet(logisticspipes.utils.tuples.Triplet) UUID(java.util.UUID) PacketHandler(logisticspipes.network.PacketHandler) List(java.util.List) IInventoryUtil(logisticspipes.interfaces.IInventoryUtil) SimpleServiceLocator(logisticspipes.proxy.SimpleServiceLocator) OrdererManagerContent(logisticspipes.network.packets.orderer.OrdererManagerContent) EntityPlayer(net.minecraft.entity.player.EntityPlayer) InvSysConResistance(logisticspipes.network.packets.pipe.InvSysConResistance) Pair(logisticspipes.utils.tuples.Pair) Entry(java.util.Map.Entry) CoreRoutedPipe(logisticspipes.pipes.basic.CoreRoutedPipe) Optional(java.util.Optional) ChannelInformation(logisticspipes.routing.channels.ChannelInformation) WorldCoordinatesWrapper(network.rs485.logisticspipes.world.WorldCoordinatesWrapper) HashMap(java.util.HashMap) TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) ItemStack(net.minecraft.item.ItemStack) IChannelManager(logisticspipes.interfaces.routing.IChannelManager) IHeadUpDisplayRendererProvider(logisticspipes.interfaces.IHeadUpDisplayRendererProvider) ItemRoutingInformation(logisticspipes.routing.ItemRoutingInformation) LinkedList(java.util.LinkedList) Nonnull(javax.annotation.Nonnull) ITransactor(logisticspipes.utils.transactor.ITransactor) Nullable(javax.annotation.Nullable) Iterator(java.util.Iterator) IGuiOpenControler(logisticspipes.interfaces.IGuiOpenControler) EnumFacing(net.minecraft.util.EnumFacing) TextureType(logisticspipes.textures.Textures.TextureType) ItemIdentifierStack(logisticspipes.utils.item.ItemIdentifierStack) TileEntity(net.minecraft.tileentity.TileEntity) IChannelRoutingConnection(logisticspipes.interfaces.routing.IChannelRoutingConnection) Comparator(java.util.Comparator) IRoutedItem(logisticspipes.logisticspipes.IRoutedItem) IOrderManagerContentReceiver(logisticspipes.interfaces.IOrderManagerContentReceiver) ChannelInformation(logisticspipes.routing.channels.ChannelInformation) IChannelManager(logisticspipes.interfaces.routing.IChannelManager) InvSysConResistance(logisticspipes.network.packets.pipe.InvSysConResistance)

Example 5 with ChannelInformation

use of logisticspipes.routing.channels.ChannelInformation in project LogisticsPipes by RS485.

the class PipeItemsInvSysConnector method sendChannelInformationToPlayers.

private void sendChannelInformationToPlayers() {
    IChannelManager manager = SimpleServiceLocator.channelManagerProvider.getChannelManager(this.getWorld());
    Optional<ChannelInformation> channel = manager.getChannels().stream().filter(chan -> chan.getChannelIdentifier().equals(getConnectionUUID())).findFirst();
    channel.ifPresent(chan -> MainProxy.sendToPlayerList(PacketHandler.getPacket(ChannelInformationPacket.class).setInformation(chan).setTargeted(true), localGuiWatchers));
}
Also used : HUDInvSysConnector(logisticspipes.gui.hud.HUDInvSysConnector) InvSysConGuiProvider(logisticspipes.network.guis.pipe.InvSysConGuiProvider) Textures(logisticspipes.textures.Textures) Item(net.minecraft.item.Item) Particles(logisticspipes.pipefxhandlers.Particles) MainProxy(logisticspipes.proxy.MainProxy) IHeadUpDisplayRenderer(logisticspipes.interfaces.IHeadUpDisplayRenderer) PlayerCollectionList(logisticspipes.utils.PlayerCollectionList) HUDStartWatchingPacket(logisticspipes.network.packets.hud.HUDStartWatchingPacket) LogisticsModule(logisticspipes.modules.LogisticsModule) Map(java.util.Map) TransportInvConnection(logisticspipes.transport.TransportInvConnection) LPNeighborTileEntityKt(network.rs485.logisticspipes.connection.LPNeighborTileEntityKt) ChannelInformationPacket(logisticspipes.network.packets.gui.ChannelInformationPacket) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) HUDStopWatchingPacket(logisticspipes.network.packets.hud.HUDStopWatchingPacket) NewGuiHandler(logisticspipes.network.NewGuiHandler) Collection(java.util.Collection) ItemIdentifier(logisticspipes.utils.item.ItemIdentifier) Set(java.util.Set) Triplet(logisticspipes.utils.tuples.Triplet) UUID(java.util.UUID) PacketHandler(logisticspipes.network.PacketHandler) List(java.util.List) IInventoryUtil(logisticspipes.interfaces.IInventoryUtil) SimpleServiceLocator(logisticspipes.proxy.SimpleServiceLocator) OrdererManagerContent(logisticspipes.network.packets.orderer.OrdererManagerContent) EntityPlayer(net.minecraft.entity.player.EntityPlayer) InvSysConResistance(logisticspipes.network.packets.pipe.InvSysConResistance) Pair(logisticspipes.utils.tuples.Pair) Entry(java.util.Map.Entry) CoreRoutedPipe(logisticspipes.pipes.basic.CoreRoutedPipe) Optional(java.util.Optional) ChannelInformation(logisticspipes.routing.channels.ChannelInformation) WorldCoordinatesWrapper(network.rs485.logisticspipes.world.WorldCoordinatesWrapper) HashMap(java.util.HashMap) TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) ItemStack(net.minecraft.item.ItemStack) IChannelManager(logisticspipes.interfaces.routing.IChannelManager) IHeadUpDisplayRendererProvider(logisticspipes.interfaces.IHeadUpDisplayRendererProvider) ItemRoutingInformation(logisticspipes.routing.ItemRoutingInformation) LinkedList(java.util.LinkedList) Nonnull(javax.annotation.Nonnull) ITransactor(logisticspipes.utils.transactor.ITransactor) Nullable(javax.annotation.Nullable) Iterator(java.util.Iterator) IGuiOpenControler(logisticspipes.interfaces.IGuiOpenControler) EnumFacing(net.minecraft.util.EnumFacing) TextureType(logisticspipes.textures.Textures.TextureType) ItemIdentifierStack(logisticspipes.utils.item.ItemIdentifierStack) TileEntity(net.minecraft.tileentity.TileEntity) IChannelRoutingConnection(logisticspipes.interfaces.routing.IChannelRoutingConnection) Comparator(java.util.Comparator) IRoutedItem(logisticspipes.logisticspipes.IRoutedItem) IOrderManagerContentReceiver(logisticspipes.interfaces.IOrderManagerContentReceiver) ChannelInformation(logisticspipes.routing.channels.ChannelInformation) IChannelManager(logisticspipes.interfaces.routing.IChannelManager)

Aggregations

ChannelInformation (logisticspipes.routing.channels.ChannelInformation)5 Optional (java.util.Optional)4 UUID (java.util.UUID)4 IChannelManager (logisticspipes.interfaces.routing.IChannelManager)4 SimpleServiceLocator (logisticspipes.proxy.SimpleServiceLocator)4 EntityPlayer (net.minecraft.entity.player.EntityPlayer)4 NewGuiHandler (logisticspipes.network.NewGuiHandler)3 TileEntity (net.minecraft.tileentity.TileEntity)3 ArrayList (java.util.ArrayList)2 Collection (java.util.Collection)2 Comparator (java.util.Comparator)2 HashMap (java.util.HashMap)2 Iterator (java.util.Iterator)2 LinkedList (java.util.LinkedList)2 List (java.util.List)2 Map (java.util.Map)2 Entry (java.util.Map.Entry)2 Set (java.util.Set)2 TreeSet (java.util.TreeSet)2 Nonnull (javax.annotation.Nonnull)2