QuantumStorage

QuantumStorage

27M Downloads

Implement new forge common interface for inventories

RealGrep opened this issue · 7 comments

commented

I just filed a PR with AE2 so they could implement IDeepStorage, since the storage bus could only see 64 items. However, it was closed with the explanation that there is a new common interface for this, used by mods like Storage Drawers. Well, anyway, no use repeating what he said. Instead, here is the PR:

AppliedEnergistics/Applied-Energistics-2#2550

Would really be nice if this worked with AE2. It's completely useless, right now, if you want to connect it to a AE2 system. Anyway, if that's not applicable, I'll let you discuss it with the AE2 team, since I haven't a clue about Forge's API. :)

Thanks!

commented

Tbh exposing the fake inventory slot might make more issues than its fixing

commented

I am going to take a look at doing this today if it all works out right I will also remove IDeepStorage

commented

I must have missed that, I will go poking around for it.

Thanks for letting us know.

commented

This is not a common interface for large inventories. Just implement a IItemHandler which exposes the full DSU say by wrapping their own API and not just the input/output buffers.

commented

I rest my case about not having a clue about Forge's API. ;)

commented

Ah, this might have been what @gigabit101 wanted me to do. It will be very easy.

commented

As heads up because IItemHandler is really restricted for anything but chests and furnaces.

extractItem requires the stacksize to be not exceed the max stacksize, due to it it makes it impossible to satisfy any request exceeding 1 stack. This is mostly troublesome for simulated operation, as these are not transactional, but have to loop over the inventory. Which causes the inventory to report an infinite amount of items. There is also no way to use getStackInSlot as alternative, because this one might not be extractable.

I just had an idea to maybe solve it, but if this one does not work, it is pretty impossible to use IItemHandler for DSU or barrel inventories. Should that happen, we probably have to use our own cap. Currently we plan it around a slotless inventory. So just a insert/extract method with the itemstack + mode and a way to obtain the inventory content. Probably as Iterator or Iterable to avoid inventories having to maintain an additional collection internally, even if there is no real way to do it. An Ìterator can easily wrap the normal getStackInSlot.


Edit: The alternative works as long as getStackInSlot returns the actual stored amount and by contract is not limited to maxStackSize