Integrated Dynamics

Integrated Dynamics

63M Downloads

Item Count and Max Stack Size in Storage Drawer

bcrotty opened this issue ยท 3 comments

commented

I don't think there is a way to get the count for a particular item in a chest or storage drawer when there are other types of items in there. You can get the count for a slot, but not the total count for an item when it has an unknown slot and/or spans multiple slots. You can also only get the count for 1 slot. When you change which slot you're referencing, it changes it for all previously created variables too.

Also, the max (stack) size shows 64 for an item in a storage drawer, when the size of the stack can be higher than that. It would be great if for a storage drawer it would show 512 (8 x 64) for a stack in a 2x2, 1024 for a 1x2, and 2048 for a 1x1.

commented

There actually is a way to get that count. You start by reading the complete inv list, mapping that list to their stacksize, using operators, and summing that list using the reduce operator.

The max stacksize is just retrieved from the item handler capability, so storage drawers probably just returns 64 for that. I'll look into it.

commented

Thanks! It'd be awesome to get an operator that takes an inventory list and an item and returns an integer that indicates the total count of that item. Seems that's an operator that would be used enough to warrant being made, but I'm just learning about ID and IT, so I'll defer to others.

commented

It'd be awesome to get an operator that takes an inventory list and an item and returns an integer that indicates the total count of that item.

This is indeed a frequently done operation, I might add this as operator or aspect in the next update.