use of appeng.api.storage.data.IAEItemStack in project LogisticsPipes by RS485.
the class AEInterfaceInventoryHandler method getItems.
@Override
public Set<ItemIdentifier> getItems() {
Set<ItemIdentifier> result = new TreeSet<>();
IStorageMonitorable tmp = tile.getMonitorable(dir, source);
if (tmp == null || tmp.getItemInventory() == null || tmp.getItemInventory().getStorageList() == null) {
return result;
}
for (IAEItemStack items : tmp.getItemInventory().getStorageList()) {
ItemIdentifier ident = ItemIdentifier.get(items.getItemStack());
result.add(ident);
}
return result;
}
use of appeng.api.storage.data.IAEItemStack in project LogisticsPipes by RS485.
the class AEInterfaceInventoryHandler method getMultipleItems.
@Override
public ItemStack getMultipleItems(ItemIdentifier item, int count) {
IStorageMonitorable tmp = tile.getMonitorable(dir, source);
if (tmp == null || tmp.getItemInventory() == null) {
return null;
}
IAEItemStack stack = AEApi.instance().storage().createItemStack(item.makeNormalStack(count));
IAEItemStack extract = tmp.getItemInventory().extractItems(stack, Actionable.MODULATE, source);
if (extract == null) {
return null;
}
return extract.getItemStack();
}
use of appeng.api.storage.data.IAEItemStack in project LogisticsPipes by RS485.
the class AEInterfaceInventoryHandler method getItemsAndCount.
private Map<ItemIdentifier, Integer> getItemsAndCount(boolean linked) {
Map<ItemIdentifier, Integer> result;
if (linked) {
result = new LinkedHashMap<>();
} else {
result = new HashMap<>();
}
IStorageMonitorable tmp = tile.getMonitorable(dir, source);
if (tmp == null || tmp.getItemInventory() == null || tmp.getItemInventory().getStorageList() == null) {
return result;
}
for (IAEItemStack items : tmp.getItemInventory().getStorageList()) {
ItemIdentifier ident = ItemIdentifier.get(items.getItemStack());
Integer count = result.get(ident);
if (count != null) {
result.put(ident, (int) (count + items.getStackSize() - (hideOnePerStack ? 1 : 0)));
} else {
result.put(ident, (int) (items.getStackSize() - (hideOnePerStack ? 1 : 0)));
}
}
return result;
}
use of appeng.api.storage.data.IAEItemStack in project PneumaticCraft by MineMaarten.
the class AE2DiskInventoryItemHandler method getStacksInItem.
@Override
public void getStacksInItem(ItemStack stack, List<ItemStack> curStacks) {
IMEInventoryHandler<IAEItemStack> cellInventoryHandler = cellRegistry.getCellInventory(stack, null, StorageChannel.ITEMS);
if (cellInventoryHandler != null) {
IItemList<IAEItemStack> cellItemList = storageHelper.createItemList();
cellInventoryHandler.getAvailableItems(cellItemList);
for (IAEItemStack aeStack : cellItemList) {
ItemStack st = aeStack.getItemStack();
//Do another getStacksize, as above retrieval caps to 64.
st.stackSize = (int) aeStack.getStackSize();
curStacks.add(st);
}
}
}
use of appeng.api.storage.data.IAEItemStack in project PneumaticCraft by MineMaarten.
the class SemiBlockRequester method onRequestChange.
//ICraftingWatcherHost
@Override
@Optional.Method(modid = ModIds.AE2)
public void onRequestChange(ICraftingGrid grid, IAEItemStack aeStack) {
craftingGrid = grid;
ItemStack stack = aeStack.getItemStack().copy();
int freeSlot = -1;
for (int i = 0; i < getFilters().getSizeInventory(); i++) {
ItemStack s = getFilters().getStackInSlot(i);
if (s != null) {
if (stack.isItemEqual(s)) {
s.stackSize = stack.stackSize;
if (s.stackSize == 0)
getFilters().setInventorySlotContents(i, null);
return;
}
} else if (freeSlot == -1) {
freeSlot = i;
}
}
if (freeSlot >= 0) {
getFilters().setInventorySlotContents(freeSlot, stack.copy());
}
}
Aggregations