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);
}
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;
}
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);
}
}
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;
}
}
}
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);
}
Aggregations