use of appeng.api.storage.IStorageMonitorable in project LogisticsPipes by RS485.
the class AEInterfaceInventoryHandler method add.
@Override
public ItemStack add(ItemStack stack, ForgeDirection from, boolean doAdd) {
ItemStack st = stack.copy();
IAEItemStack tst = AEApi.instance().storage().createItemStack(stack);
IStorageMonitorable tmp = tile.getMonitorable(dir, source);
if (tmp == null || tmp.getItemInventory() == null) {
return st;
}
IAEItemStack overflow = tmp.getItemInventory().injectItems(tst, Actionable.MODULATE, source);
if (overflow != null) {
st.stackSize -= overflow.getStackSize();
}
return st;
}
use of appeng.api.storage.IStorageMonitorable in project LogisticsPipes by RS485.
the class AEInterfaceInventoryHandler method getSingleItem.
@Override
public ItemStack getSingleItem(ItemIdentifier item) {
IStorageMonitorable tmp = tile.getMonitorable(dir, source);
if (tmp == null || tmp.getItemInventory() == null) {
return null;
}
IAEItemStack stack = AEApi.instance().storage().createItemStack(item.makeNormalStack(1));
IAEItemStack extract = tmp.getItemInventory().extractItems(stack, Actionable.MODULATE, source);
if (extract == null) {
return null;
}
return extract.getItemStack();
}
use of appeng.api.storage.IStorageMonitorable in project LogisticsPipes by RS485.
the class AEInterfaceInventoryHandler method roomForItem.
@Override
public int roomForItem(ItemIdentifier item, int count) {
IStorageMonitorable tmp = tile.getMonitorable(dir, source);
if (tmp == null || tmp.getItemInventory() == null) {
return 0;
}
while (count > 0) {
IAEItemStack stack = AEApi.instance().storage().createItemStack(item.makeNormalStack(count));
if (tmp.getItemInventory().canAccept(stack)) {
return count;
}
count--;
}
return 0;
}
Aggregations