InventoryIterator suggestion
Speiger opened this issue ยท 4 comments
I have nodest a little interesting thing with your Inventory Iterator.
I implemented a kind of close system into IC2 Classic (based on the BC ones)
and there i nodest that you mark a inventory dirty even if nothing got extracted.
Now in your mods case that is not happening but you are marking it for every action dirty which is also kind of bad. Mark dirty should be only called when you finished your operations and did something important (Like extracted/inserted) something and not for every action.
If you are using that system on Jabba Barrels you get only for the insertion a lot of mark dirty calls.
Example with jabba barrels:
You are checking the slots:
for every slot you call it throws a mark dirty.
Then you extract something it will call 2 mark dirties (1 from you and 1 from jabba)
and then you are done.
and looking at your code i nodest you are checking very often for slots in 1 extraction/insertion action
So you throw a lot of times a (only with Jabba interaction) mark dirty
What i suggest is: do every action what you want to do, and when you are done you check if something got extracted/inserted and that it was not a Fake and then you throw a mark dirty.
Because it is only nessesary to do this once per extraction/insertion and not on every drain or adding...
I'm sorry, you'll have to point at the specific line of code to which you are referring. I don't recall and cannot find the behavior you are describing.
From what I can see, the Inventory Iterators only mark dirty on changes, not access.
Simply add here a doAdd Check in, if true then he marks the Inventory Dirty
And here a Is something in there and a doRemove check. Same thing with the if state and the result of that.