mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-14 01:39:36 -04:00
Merge pull request #2181 from Vexatos/fix-item-inventory-control
Fixed methods ItemInventoryControl not doing what they are supposed to do.
This commit is contained in:
commit
a131029fd1
@ -17,19 +17,21 @@ trait ItemInventoryControl extends InventoryAware {
|
|||||||
withItemInventory(args.checkSlot(inventory, 0), itemInventory => result(itemInventory.getSizeInventory))
|
withItemInventory(args.checkSlot(inventory, 0), itemInventory => result(itemInventory.getSizeInventory))
|
||||||
}
|
}
|
||||||
|
|
||||||
@Callback(doc = "function(inventorySlot:number, slot:number[, count:number=64]):number -- The size of an item inventory in the specified slot.")
|
@Callback(doc = "function(inventorySlot:number, slot:number[, count:number=64]):number -- Drops an item into the specified slot in the item inventory.")
|
||||||
def dropIntoItemInventory(context: Context, args: Arguments): Array[AnyRef] = {
|
def dropIntoItemInventory(context: Context, args: Arguments): Array[AnyRef] = {
|
||||||
withItemInventory(args.checkSlot(inventory, 0), itemInventory => {
|
withItemInventory(args.checkSlot(inventory, 0), itemInventory => {
|
||||||
val count = args.optItemCount(1)
|
val slot = args.checkSlot(itemInventory, 1)
|
||||||
result(InventoryUtils.extractAnyFromInventory(InventoryUtils.insertIntoInventory(_, itemInventory), inventory, ForgeDirection.UNKNOWN, count))
|
val count = args.optItemCount(2)
|
||||||
|
result(InventoryUtils.extractAnyFromInventory(InventoryUtils.insertIntoInventorySlot(_, itemInventory, Option(ForgeDirection.UNKNOWN), slot), inventory, ForgeDirection.UNKNOWN, count))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@Callback(doc = "function(inventorySlot:number, slot:number[, count:number=64]):number -- The size of an item inventory in the specified slot.")
|
@Callback(doc = "function(inventorySlot:number, slot:number[, count:number=64]):number -- Sucks an item out of the specified slot in the item inventory.")
|
||||||
def suckFromItemInventory(context: Context, args: Arguments): Array[AnyRef] = {
|
def suckFromItemInventory(context: Context, args: Arguments): Array[AnyRef] = {
|
||||||
withItemInventory(args.checkSlot(inventory, 0), itemInventory => {
|
withItemInventory(args.checkSlot(inventory, 0), itemInventory => {
|
||||||
val count = args.optItemCount(1)
|
val slot = args.checkSlot(itemInventory, 1)
|
||||||
result(InventoryUtils.extractAnyFromInventory(InventoryUtils.insertIntoInventory(_, inventory, slots = Option(insertionSlots)), itemInventory, ForgeDirection.UNKNOWN, count))
|
val count = args.optItemCount(2)
|
||||||
|
result(InventoryUtils.extractFromInventorySlot(InventoryUtils.insertIntoInventory(_, inventory, slots = Option(insertionSlots)), itemInventory, ForgeDirection.UNKNOWN, slot, count))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user