This commit is contained in:
Florian Nücke 2015-11-15 21:08:21 +01:00
parent bee560c9ab
commit 5c0a4f7b82

View File

@ -8,6 +8,7 @@ import net.minecraft.entity.player.InventoryPlayer
import net.minecraft.item.Item
import net.minecraft.item.ItemStack
import net.minecraft.nbt.NBTTagList
import li.cil.oc.util.ExtendedInventory._
class Inventory(val agent: internal.Agent) extends InventoryPlayer(null) {
def selectedItemStack = agent.mainInventory.getStackInSlot(agent.selectedSlot)
@ -54,8 +55,7 @@ class Inventory(val agent: internal.Agent) extends InventoryPlayer(null) {
}
override def addItemStackToInventory(stack: ItemStack) = {
val indices = 0 until getSizeInventory
val slots = indices.drop(agent.selectedSlot) ++ indices.take(agent.selectedSlot)
val slots = this.indices.drop(agent.selectedSlot) ++ this.indices.take(agent.selectedSlot)
InventoryUtils.insertIntoInventory(stack, this, slots = Option(slots))
}