i am rewriting the forge IItemHandler
loordgek opened this issue ยท 6 comments
i am rewriting the forge IItemHandler
https://github.com/loordgek/itemhandlerV2
the plan is to make it more flexible and better performance (looks at ColossalChests)
if you have questions/suggestions leave them
here MinecraftForge/MinecraftForge#3344
I'm subscribed to that issue already, so I see everything that is mentioned there.
But as other people have already mentioned, your proposal looks very complex, and contains methods that are not required, such as calcRedStoneFromInventory
.
Also, the Predicate
in your method extract(Range<Integer> slotRange, Predicate<ItemStack> filter, int amount, boolean simulate)
does not allow any optimized lookups in inventories, as Predicate
is basically a blackbox. Something like this would for example allow for optimizations: https://github.com/CyclopsMC/CommonCapabilitiesAPI/blob/master-1.12/capability/itemhandler/ISlotlessItemHandler.java#L66
Furthermore, the new item handler interface should allow for simulated insertion chains, which is not possible in the current IH and your implementation (as far as I can see).
Furthermore, the new item handler interface should allow for simulated insertion chains, which is not possible in the current IH and your implementation (as far as I can see).
where is that not possible
i was thinking for CC that you keep a list w/ the slots that contain stacks and itr over that
same for calcRedStoneFromInventory
i was thinking for CC that you keep a list w/ the slots that contain stacks
That's still O(n)
when all slots are filled. So horrible performance for something like Colossal Chests.