use of logisticspipes.utils.item.ItemIdentifierStack in project LogisticsPipes by RS485.
the class SelectItemOutOfList method renderGuiBackground.
@Override
protected void renderGuiBackground(int par1, int par2) {
GuiGraphics.drawGuiBackGround(mc, guiLeft, guiTop, right, bottom, zLevel, true);
//TODO
fontRendererObj.renderString(StringUtils.translate("misc.selectType"), guiLeft + 10, guiTop + 6, 0x404040, false);
String pageString = Integer.toString(page + 1) + "/" + Integer.toString(maxPage);
fontRendererObj.renderString(pageString, guiLeft + 128 - (fontRendererObj.getStringWidth(pageString) / 2), guiTop + 6, 0x404040, false);
int x = 0;
int y = -page * 10;
for (ItemIdentifierStack stack : canidate) {
if (y >= 0) {
GuiGraphics.drawSlotBackground(mc, guiLeft + 4 + x * 18, guiTop + 16 + y * 18);
}
x++;
if (x > 7) {
x = 0;
y++;
}
if (y > 9) {
break;
}
}
}
use of logisticspipes.utils.item.ItemIdentifierStack in project LogisticsPipes by RS485.
the class ModuleCrafter method registerExtras.
@Override
public void registerExtras(IPromise promise) {
if (promise instanceof LogisticsDictPromise) {
_service.getItemOrderManager().addExtra(((LogisticsDictPromise) promise).getResource());
return;
} else {
ItemIdentifierStack stack = new ItemIdentifierStack(promise.getItemType(), promise.getAmount());
_service.getItemOrderManager().addExtra(new DictResource(stack, null));
}
}
use of logisticspipes.utils.item.ItemIdentifierStack in project LogisticsPipes by RS485.
the class ModuleOreDictItemSink method buildOreItemIdMap.
private void buildOreItemIdMap() {
oreItemIdMap = new HashMap<>();
oreHudList = new ArrayList<>(oreList.size());
for (String orename : oreList) {
List<ItemStack> items = OreDictionary.getOres(orename);
ItemStack stackForHud = null;
for (ItemStack stack : items) {
if (stack != null) {
if (stackForHud == null) {
stackForHud = stack;
}
if (stack.getItemDamage() == OreDictionary.WILDCARD_VALUE) {
oreItemIdMap.put(stack.getItem(), new TreeSet<>());
} else {
Set<Integer> damageSet = oreItemIdMap.get(stack.getItem());
if (damageSet == null) {
damageSet = new TreeSet<>();
damageSet.add(stack.getItemDamage());
oreItemIdMap.put(stack.getItem(), damageSet);
} else if (!damageSet.isEmpty()) {
damageSet.add(stack.getItemDamage());
}
}
}
}
if (stackForHud != null) {
ItemStack t = stackForHud.copy();
if (t.getItemDamage() == OreDictionary.WILDCARD_VALUE) {
t.setItemDamage(0);
}
oreHudList.add(new ItemIdentifierStack(ItemIdentifier.get(t), 1));
} else {
oreHudList.add(new ItemIdentifierStack(ItemIdentifier.get(Item.getItemFromBlock(Blocks.fire), 0, null), 1));
}
}
}
use of logisticspipes.utils.item.ItemIdentifierStack in project LogisticsPipes by RS485.
the class ModuleItemSink method sinksItem.
@Override
public SinkReply sinksItem(ItemIdentifier item, int bestPriority, int bestCustomPriority, boolean allowDefault, boolean includeInTransit) {
if (_isDefaultRoute && !allowDefault) {
return null;
}
if (bestPriority > _sinkReply.fixedPriority.ordinal() || (bestPriority == _sinkReply.fixedPriority.ordinal() && bestCustomPriority >= _sinkReply.customPriority)) {
return null;
}
if (_filterInventory.containsUndamagedItem(item.getUndamaged())) {
if (_service.canUseEnergy(1)) {
return _sinkReply;
}
return null;
}
if (_service.getUpgradeManager(slot, positionInt).isFuzzyUpgrade()) {
for (Pair<ItemIdentifierStack, Integer> stack : _filterInventory) {
if (stack == null) {
continue;
}
if (stack.getValue1() == null) {
continue;
}
ItemIdentifier ident1 = item;
ItemIdentifier ident2 = stack.getValue1().getItem();
if (ignoreData.get(stack.getValue2())) {
ident1 = ident1.getIgnoringData();
ident2 = ident2.getIgnoringData();
}
if (ignoreNBT.get(stack.getValue2())) {
ident1 = ident1.getIgnoringNBT();
ident2 = ident2.getIgnoringNBT();
}
if (ident1.equals(ident2)) {
if (_service.canUseEnergy(5)) {
return _sinkReply;
}
return null;
}
}
}
if (_isDefaultRoute) {
if (bestPriority > _sinkReplyDefault.fixedPriority.ordinal() || (bestPriority == _sinkReplyDefault.fixedPriority.ordinal() && bestCustomPriority >= _sinkReplyDefault.customPriority)) {
return null;
}
if (_service.canUseEnergy(1)) {
return _sinkReplyDefault;
}
return null;
}
return null;
}
use of logisticspipes.utils.item.ItemIdentifierStack in project LogisticsPipes by RS485.
the class RequestRunningCraftingTasks method processPacket.
@Override
public void processPacket(EntityPlayer player) {
LogisticsStatisticsTileEntity tile = this.getTile(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