mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-10 07:45:05 -04:00
better handle buggy IItemHandlers
This commit is contained in:
parent
318d82092c
commit
eb2619b6de
@ -142,8 +142,12 @@ object InventoryUtils {
|
||||
val count = (amount - extracted.getCount) max 0
|
||||
if (count > 0) inventory.extractItem(slot, count, false) match {
|
||||
case realExtracted: ItemStack if realExtracted.getCount == count => consumer(realExtracted, false)
|
||||
case _ =>
|
||||
case realExtracted =>
|
||||
OpenComputers.log.warn("An IItemHandler instance acted differently between simulated and non-simulated extraction. Offender: " + inventory)
|
||||
// Attempt inserting the stack anyway, to minimize world-side item loss.
|
||||
if (realExtracted != null && !realExtracted.isEmpty) {
|
||||
consumer(realExtracted, false)
|
||||
}
|
||||
}
|
||||
count
|
||||
case _ => 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user