Railcraft

Railcraft

34M Downloads

Use setInventorySlotContents instead of modifying stackSize directly

copygirl opened this issue ยท 5 comments

commented

When Item Unloaders put items into another inventory, and there's already an item of the same type in there, I suspect it's modifying the stackSize of that stack, instead of creating another ItemStack and using setInventorySlotContents. Because my Storage Crates only simulate an inventory, their actual internal storage is not accessible, they simply ignore the changed stackSize and the items are lost forever.

Have a look at http://github.com/copyboy/mod_BetterStorage if you want to see some code.

Since BuildCraft pipes have the same issue I will post the same issue on their tracker.
(I should note that ComputerCraft and Thermal Expansion work just fine with crates, and Thaumcraft will have a fix soon, hopefully.)

commented

Yes, Railcraft supports ISpecialInventory.

I'd prefer to avoid adding even more ItemStack cloning if possible. That's my primary reason I'm hesitant to do this (particularly when it would already work with ISpecial).

commented

And I'd prefer to avoid using the BuildCraft API for something so simple, especially when to me it looks like the problem lies within another mod. Also I'm not a fan of BuildCraft, so I don't think the API will be to my liking either ^^

Regarding you using BC code, I was just wondering whether you used it to insert items into any inventory in general, in which case I'd only have to bug Sengir about this for the fix. (Sounds like that's not the case.)

commented

No, I just support that API, I don't actually use BC transactors or anything.

commented

My suggestion is to implement ISpecialInventory from the BC API on your Crates.

commented

I'll have to think about that, but I'll probably avoid it until Forge has it, or something similar, built-in.

Do you use BuildCraft code to insert items into other inventories?
If not, could you fix this anyway? It's simple and doesn't affect anything that's already working, and will only add support for other mods, should they choose to do something similar.