Lib Block Attributes

Lib Block Attributes

853k Downloads

Iterating over items

Fuyukai opened this issue ยท 7 comments

commented

Less of an issue, more of a request - it would be nice if it was possible to iterate over the stacks in FixedItemInvView. It's achievable with a loop over a range and getItemStack but it would be useful to have an iterator built-in - doubly so for iterating over getSubInv.

commented

I'm not really sure about making FixedItemInvView implement Iterable directly, however I would be happy to add two methods: default Iterable<ItemStack> stackIterable() {} and default Iterable<? extends SingleItemSlotView> slotIterable() {} - would those be enough?

(I don't want to implement Iterable directly because it's probably more useful to iterate over modifiable slots rather than just the contained ItemStack's directly - however making FixedItemInvView implement Iterable<? extends SingleItemSlotView> isn't permitted, so hopefully two methods would work better?)

commented

Yes, those would be perfectly fine, thank you.

commented

Ok, I'll add them to 0.4.15.

(While you're asking, is there anything else you'd like added? It seems a bit silly for me to have pushed 0.4.14 and 0.4.15 in quick succession :P )

commented

I'm actually using the 0.5 branch, unfortunately (I probably should've mentioned that initially!) Otherwise, everything in the library seems to be exactly what I need from what I've done so far.

commented

Oh ok. (I haven't formally released that yet so I don't mind spamming pre-releases quite as much)

commented

Ok, this should be in 0.4.15 and 0.5.0-pre6 on the maven

commented

Builds and runs all perfectly fine on -pre6. Thank you very much!