pantheis/ChargingBench — pull request #11 by Tallinu (2012-09-28 08:23:37+00:00)
Title: API bug workarounds complete. Should work fine now.

Turns out .charge and .discharge are automatically switching the ItemID of a stack if it ends up full or empty. We don't have to switch it manually before charging it, and when a battery runs out the test to see if it was still the charged ID wasn't working, because it wasn't. I had to put in an additional simulated .discharge of 1 EU to check if it was actually empty, and if so, create a new stack without the stupid "zero energy" tag compound that it leaves on everything it touches.

We're still having to create a copy of an item stack before doing a simulated .charge to keep it from slapping "zero energy" tags on every item placed in the charging area whether they're stackable or not, and that's a performance penalty per item per tick. But until they fix that, the only other way I can see to handle the problem is to test if the item is stackable or not and if so, test using a copy instead of the real thing. I'll see if I can figure out how complex that would be to set up. The less object creation and destruction we're causing the better.