From 61b26e17cb25bdc49d59edfb4ea0f6bf5f817487 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20N=C3=BCcke?= Date: Mon, 12 Jan 2015 03:31:10 +0100 Subject: [PATCH] Added backwards compatibility to inventory_controller.getStackInSlot, closes #803. --- .../oc/server/component/UpgradeInventoryController.scala | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/scala/li/cil/oc/server/component/UpgradeInventoryController.scala b/src/main/scala/li/cil/oc/server/component/UpgradeInventoryController.scala index 48e9691a0..5e97814d9 100644 --- a/src/main/scala/li/cil/oc/server/component/UpgradeInventoryController.scala +++ b/src/main/scala/li/cil/oc/server/component/UpgradeInventoryController.scala @@ -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 + } } }