Item Interface's getSlots method is slow
TomyLobo opened this issue ยท 0 comments
The number of slots is already determined (and later discarded) here:
https://github.com/Ellpeck/ActuallyAdditions/blob/master/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewer.java#L197
So why not cache that value and return it whenever getSlots is called?
This became relevant when I attached an AA item interface to an Integrated Dynamics network.
ID's IngredientObserver alone used to query getSlots twice for every single slot(!) of each attached inventory.
See also this currently unreleased fix for the problem on ID's side: CyclopsMC/CommonCapabilitiesAPI#7