diff --git a/src/main/java/li/cil/oc/api/internal/Robot.java b/src/main/java/li/cil/oc/api/internal/Robot.java
index f99b98540..ed3d5e041 100644
--- a/src/main/java/li/cil/oc/api/internal/Robot.java
+++ b/src/main/java/li/cil/oc/api/internal/Robot.java
@@ -17,8 +17,8 @@ import net.minecraftforge.fluids.IFluidHandler;
* follows:
*
* - Tool
- * - containerCount hot-swappable components.
- * - inventorySize internal inventory slots.
+ * - equipmentInventory.getSizeInventory hot-swappable components.
+ * - mainInventory.getSizeInventory internal inventory slots.
* - componentCount hard-wired components.
*
* Note that there may be no hot-swappable (or even built-in) components or
@@ -28,26 +28,11 @@ import net.minecraftforge.fluids.IFluidHandler;
* This interface is not meant to be implemented, just used.
*/
public interface Robot extends Agent, Environment, EnvironmentHost, Rotatable, Tiered, ISidedInventory, IFluidHandler {
- /**
- * The number of hot-swappable component slots in this robot.
- *
- * Note: this will always be three, regardless of the number of
- * installed containers. For unused slots the inventory will simply be
- * empty at that slot.
- */
- int containerCount();
-
/**
* The number of built-in components in this robot.
*/
int componentCount();
- /**
- * The size of the internal inventory in this robot, excluding tool and
- * component slots.
- */
- int inventorySize();
-
/**
* Get the environment for the component in the specified slot.
*
diff --git a/src/main/scala/li/cil/oc/common/tileentity/Robot.scala b/src/main/scala/li/cil/oc/common/tileentity/Robot.scala
index 30431731c..0f475e517 100644
--- a/src/main/scala/li/cil/oc/common/tileentity/Robot.scala
+++ b/src/main/scala/li/cil/oc/common/tileentity/Robot.scala
@@ -139,7 +139,9 @@ class Robot extends traits.Computer with traits.PowerInformation with IFluidHand
override def setSelectedSlot(index: Int): Unit = {
selectedSlot = index max 0 min mainInventory.getSizeInventory - 1
- ServerPacketSender.sendRobotSelectedSlotChange(this)
+ if (world != null) {
+ ServerPacketSender.sendRobotSelectedSlotChange(this)
+ }
}
val tank = new internal.MultiTank {
@@ -157,7 +159,7 @@ class Robot extends traits.Computer with traits.PowerInformation with IFluidHand
// Fixed number of containers (mostly due to GUI limitation, but also because
// I find three to be a large enough number for sufficient flexibility).
- override def containerCount = 3
+ def containerCount = 3
override def componentCount = info.components.length
diff --git a/src/main/scala/li/cil/oc/common/tileentity/RobotProxy.scala b/src/main/scala/li/cil/oc/common/tileentity/RobotProxy.scala
index 469c0d771..e7672547c 100644
--- a/src/main/scala/li/cil/oc/common/tileentity/RobotProxy.scala
+++ b/src/main/scala/li/cil/oc/common/tileentity/RobotProxy.scala
@@ -40,10 +40,16 @@ class RobotProxy(val robot: Robot) extends traits.Computer with traits.PowerInfo
override def tank = robot.tank
+ override def selectedSlot = robot.selectedSlot
+
override def setSelectedSlot(index: Int) = robot.setSelectedSlot(index)
+ override def selectedTank = robot.selectedTank
+
override def setSelectedTank(index: Int) = robot.setSelectedTank(index)
+ override def player() = robot.player()
+
// ----------------------------------------------------------------------- //
override def connectComponents() {}
@@ -56,20 +62,12 @@ class RobotProxy(val robot: Robot) extends traits.Computer with traits.PowerInfo
@SideOnly(Side.CLIENT)
override def setRunning(value: Boolean) = robot.setRunning(value)
- override def player() = robot.player()
-
- override def containerCount = robot.containerCount
+ // ----------------------------------------------------------------------- //
override def componentCount = robot.componentCount
- override def inventorySize = robot.inventorySize
-
override def getComponentInSlot(index: Int) = robot.getComponentInSlot(index)
- override def selectedSlot = robot.selectedSlot
-
- override def selectedTank = robot.selectedTank
-
override def synchronizeSlot(slot: Int) = robot.synchronizeSlot(slot)
// ----------------------------------------------------------------------- //
diff --git a/src/main/scala/li/cil/oc/server/machine/Machine.scala b/src/main/scala/li/cil/oc/server/machine/Machine.scala
index 0adf53818..957c8fc2b 100644
--- a/src/main/scala/li/cil/oc/server/machine/Machine.scala
+++ b/src/main/scala/li/cil/oc/server/machine/Machine.scala
@@ -188,6 +188,7 @@ class Machine(val host: MachineHost) extends prefab.ManagedEnvironment with mach
override def start(): Boolean = state.synchronized(state.top match {
case Machine.State.Stopped =>
+ onHostChanged()
processAddedComponents()
verifyComponents()
if (!Settings.get.ignorePower && node.globalBuffer < cost) {
diff --git a/src/main/scala/li/cil/oc/util/ExtendedArguments.scala b/src/main/scala/li/cil/oc/util/ExtendedArguments.scala
index b19e9b6f4..a6b682f6d 100644
--- a/src/main/scala/li/cil/oc/util/ExtendedArguments.scala
+++ b/src/main/scala/li/cil/oc/util/ExtendedArguments.scala
@@ -1,7 +1,6 @@
package li.cil.oc.util
import li.cil.oc.api.internal.MultiTank
-import li.cil.oc.api.internal.Robot
import li.cil.oc.api.machine.Arguments
import net.minecraft.inventory.IInventory
import net.minecraftforge.common.util.ForgeDirection
@@ -38,14 +37,6 @@ object ExtendedArguments {
else default
}
- def checkSlot(robot: Robot, n: Int) = {
- val slot = args.checkInteger(n) - 1
- if (slot < 0 || slot >= robot.inventorySize) {
- throw new IllegalArgumentException("invalid slot")
- }
- slot + 1 + robot.containerCount
- }
-
def checkTank(multi: MultiTank, n: Int) = {
val tank = args.checkInteger(n) - 1
if (tank < 0 || tank >= multi.tankCount) {