Added backwards compatibility to inventory_controller.getStackInSlot, closes #803.

This commit is contained in:
Florian Nücke 2015-01-12 03:31:10 +01:00
parent bce4a60394
commit 61b26e17cb

View File

@ -9,6 +9,7 @@ import li.cil.oc.api.network._
import li.cil.oc.api.prefab
import li.cil.oc.common.entity
import li.cil.oc.common.tileentity
import li.cil.oc.server.machine.ArgumentsImpl
import li.cil.oc.util.BlockPosition
import li.cil.oc.util.ExtendedArguments._
import net.minecraft.entity.Entity
@ -74,6 +75,14 @@ object UpgradeInventoryController {
}
else result(false)
}
// TODO Remove in 1.5
@Callback(doc = """function(side:number, slot:number):table -- Get a description of the stack in the the inventory on the specified side of the robot.""")
override def getStackInSlot(context: Context, args: Arguments) = {
if (args.optInteger(0, -1) == ForgeDirection.NORTH.ordinal) // sides.back
getStackInInternalSlot(context, new ArgumentsImpl(args.toArray.drop(1))) // drop side, just pass slot
else super.getStackInSlot(context, args) // normal call
}
}
}