Storage Drawers

Storage Drawers

151M Downloads

1.8.9 IItemHandler

pauljoda opened this issue ยท 6 comments

commented

Forge has introduced the new IItemHandler system. It has been stated that all mods should move to this system and leave IInventory and ISidedInventory as they allow access to ItemStacks, which should be left immutable. It is now expected that this is the interface to handle for inventories. Along with this, you should also implement the IItemHandler capability to allow mods to check if the tile has a capability without needing to use an interface. This is also what has been stated as what should be standard by the forge team.

I am a developer of NeoTech and our pipes have moved to the new system. In doing so, we are no longer able to communicate with your inventories as they seem to be using the old ISided interface. I know the change can be a bother, but it is what is expected and what will be supported in the future. If we as the first mods in 1.8.9 set the standard and use this new system as forge intends we can set the bar for other mods. I encourage you to please update to this system. I am willing to provide any support in this matter as I have been working with the new system for a bit now and feel I have an understanding of it.

commented

Yes, it's on my short list of things to do for the 1.8 branch. I was monitoring the PR when it went through.

I will try and make time this week to update it. It would be great if you could do some additional testing on it once it's updated.

I guess now is also a good time to ask if anything in NeoTech needs deep storage awareness. The new Forge item handler API gets a little closer, but didn't deliver a complete solution.

commented

The only thing we will be asking from your tiles is the insert and extract functions. This is by side if that helps. Whatever stacks you pass with that we will use. There is no accessing of the itemstacks directly by us if that is what you mean by deep storage. If you mean something like you are just using an integer count, then it would be up to you to handle reduction and addition to that value and sending a stack back to us to extract.

We would be happy to test and have some helpful people testing with us. That is how we found this issue. If you need to reach out to us or need anymore info we are in the #Neotech IRC channel

commented

By deep storage support, I'll use Thermal Dynamics as an example.

Deep storage by convention in 1.7.10 can only expose 1 stack of items at a time, using an independent input and output slot. At any given moment it appears to only have one stack of items available, and one slot free for a single stack.

So when a mod like Thermal Dynamics wants to empty an entire chest of dirt, it sees a single slot open, sends a single stack down the pipe, and when that stack is accepted it sees the slot open again and sends another stack.

For any mod that implemented IDeepStorageHandler though, it would query the slot for its true remaining capacity, and blast the entire collection of item stacks into the network as quickly as possible, since it knew the target inventory could accommodate it.

That is the one aspect of deep storage that I remember IItemHandler lacking. The case of querying how many items are in a given slot can be handled now because the API permits me to return a stack size greater than the item max stack size in the get method.

commented

Ah I see. No we don't use deep storage. The speed of the pipes is determined by the upgrades installed, so we will only handle at most a stack at a time. Our pipes also work on an extraction/sink system. It is not the sink asking for resources, but the extraction asking if the sink will accept what it is attempting to move.

I believe that answers your question, no we don't handle deep storage. We just handle whatever stack is sent to use via the IItemHandler capability

commented

There's a preliminary build in the GitHub releases section for the IItemHandler support. It seems to work okay with standard drawers.

It is not working with controllers at all. I think it has something to do with the tile copying. Controllers track a very large amount of metadata that's constantly updated and not persisted to NBT. That data is absent on the tile that's passed to the IItemHandler.

commented

This is implemented and released in 2.4.1.