Search in sources :

Example 1 with LogisticsStatisticsTileEntity

use of logisticspipes.blocks.stats.LogisticsStatisticsTileEntity in project LogisticsPipes by RS485.

the class RequestAmountTaskSubGui method processPacket.

@Override
public void processPacket(EntityPlayer player) {
    LogisticsStatisticsTileEntity tile = this.getTileAs(player.getEntityWorld(), LogisticsStatisticsTileEntity.class);
    CoreRoutedPipe pipe = tile.getConnectedPipe();
    if (pipe == null) {
        return;
    }
    Map<ItemIdentifier, Integer> _availableItems = SimpleServiceLocator.logisticsManager.getAvailableItems(pipe.getRouter().getIRoutersByCost());
    LinkedList<ItemIdentifier> _craftableItems = SimpleServiceLocator.logisticsManager.getCraftableItems(pipe.getRouter().getIRoutersByCost());
    TreeSet<ItemIdentifierStack> _allItems = new TreeSet<>();
    for (Entry<ItemIdentifier, Integer> item : _availableItems.entrySet()) {
        ItemIdentifierStack newStack = item.getKey().makeStack(item.getValue());
        _allItems.add(newStack);
    }
    for (ItemIdentifier item : _craftableItems) {
        if (_availableItems.containsKey(item)) {
            continue;
        }
        _allItems.add(item.makeStack(1));
    }
    MainProxy.sendPacketToPlayer(PacketHandler.getPacket(AmountTaskSubGui.class).setIdentSet(_allItems), player);
}
Also used : LogisticsStatisticsTileEntity(logisticspipes.blocks.stats.LogisticsStatisticsTileEntity) ItemIdentifier(logisticspipes.utils.item.ItemIdentifier) TreeSet(java.util.TreeSet) CoreRoutedPipe(logisticspipes.pipes.basic.CoreRoutedPipe) ItemIdentifierStack(logisticspipes.utils.item.ItemIdentifierStack)

Example 2 with LogisticsStatisticsTileEntity

use of logisticspipes.blocks.stats.LogisticsStatisticsTileEntity in project LogisticsPipes by RS485.

the class StatisticsGui method getClientGui.

@Override
public Object getClientGui(EntityPlayer player) {
    LogisticsStatisticsTileEntity statisticsTable = getTileAs(player.world, LogisticsStatisticsTileEntity.class);
    statisticsTable.tasks = trackingList;
    GuiStatistics gui = new GuiStatistics(statisticsTable);
    gui.inventorySlots = new DummyContainer(player.inventory, null);
    return gui;
}
Also used : LogisticsStatisticsTileEntity(logisticspipes.blocks.stats.LogisticsStatisticsTileEntity) DummyContainer(logisticspipes.utils.gui.DummyContainer) GuiStatistics(logisticspipes.gui.GuiStatistics)

Example 3 with LogisticsStatisticsTileEntity

use of logisticspipes.blocks.stats.LogisticsStatisticsTileEntity in project LogisticsPipes by RS485.

the class AddItemToTrackPacket method processPacket.

@Override
public void processPacket(EntityPlayer player) {
    LogisticsStatisticsTileEntity tile = this.getTileAs(player.getEntityWorld(), LogisticsStatisticsTileEntity.class);
    boolean found = false;
    for (TrackingTask task : tile.tasks) {
        if (task.item.equals(item)) {
            found = true;
            break;
        }
    }
    if (!found) {
        TrackingTask task = new TrackingTask();
        task.item = item;
        tile.tasks.add(task);
    }
}
Also used : LogisticsStatisticsTileEntity(logisticspipes.blocks.stats.LogisticsStatisticsTileEntity) TrackingTask(logisticspipes.blocks.stats.TrackingTask)

Example 4 with LogisticsStatisticsTileEntity

use of logisticspipes.blocks.stats.LogisticsStatisticsTileEntity in project LogisticsPipes by RS485.

the class RemoveAmoundTask method processPacket.

@Override
public void processPacket(EntityPlayer player) {
    LogisticsStatisticsTileEntity tile = this.getTileAs(player.getEntityWorld(), LogisticsStatisticsTileEntity.class);
    Iterator<TrackingTask> iter = tile.tasks.iterator();
    while (iter.hasNext()) {
        TrackingTask task = iter.next();
        if (task.item == item) {
            iter.remove();
            break;
        }
    }
}
Also used : LogisticsStatisticsTileEntity(logisticspipes.blocks.stats.LogisticsStatisticsTileEntity) TrackingTask(logisticspipes.blocks.stats.TrackingTask)

Example 5 with LogisticsStatisticsTileEntity

use of logisticspipes.blocks.stats.LogisticsStatisticsTileEntity in project LogisticsPipes by RS485.

the class RequestRunningCraftingTasks method processPacket.

@Override
public void processPacket(EntityPlayer player) {
    LogisticsStatisticsTileEntity tile = this.getTileAs(player.getEntityWorld(), LogisticsStatisticsTileEntity.class);
    CoreRoutedPipe pipe = tile.getConnectedPipe();
    if (pipe == null) {
        return;
    }
    List<ItemIdentifierStack> items = new ArrayList<>();
    for (ExitRoute r : pipe.getRouter().getIRoutersByCost()) {
        if (r == null) {
            continue;
        }
        if (r.destination.getPipe() instanceof PipeItemsCraftingLogistics) {
            PipeItemsCraftingLogistics crafting = (PipeItemsCraftingLogistics) r.destination.getPipe();
            List<ItemIdentifierStack> content = crafting.getItemOrderManager().getContentList(player.getEntityWorld());
            items.addAll(content);
        }
    }
    MainProxy.sendPacketToPlayer(PacketHandler.getPacket(RunningCraftingTasks.class).setIdentList(items), player);
}
Also used : LogisticsStatisticsTileEntity(logisticspipes.blocks.stats.LogisticsStatisticsTileEntity) PipeItemsCraftingLogistics(logisticspipes.pipes.PipeItemsCraftingLogistics) ArrayList(java.util.ArrayList) CoreRoutedPipe(logisticspipes.pipes.basic.CoreRoutedPipe) ItemIdentifierStack(logisticspipes.utils.item.ItemIdentifierStack) ExitRoute(logisticspipes.routing.ExitRoute)

Aggregations

LogisticsStatisticsTileEntity (logisticspipes.blocks.stats.LogisticsStatisticsTileEntity)5 TrackingTask (logisticspipes.blocks.stats.TrackingTask)2 CoreRoutedPipe (logisticspipes.pipes.basic.CoreRoutedPipe)2 ItemIdentifierStack (logisticspipes.utils.item.ItemIdentifierStack)2 ArrayList (java.util.ArrayList)1 TreeSet (java.util.TreeSet)1 GuiStatistics (logisticspipes.gui.GuiStatistics)1 PipeItemsCraftingLogistics (logisticspipes.pipes.PipeItemsCraftingLogistics)1 ExitRoute (logisticspipes.routing.ExitRoute)1 DummyContainer (logisticspipes.utils.gui.DummyContainer)1 ItemIdentifier (logisticspipes.utils.item.ItemIdentifier)1