diff --git a/src/minecraft/assemblyline/common/machine/armbot/TileEntityArmbot.java b/src/minecraft/assemblyline/common/machine/armbot/TileEntityArmbot.java index d502a6104..a29e727c5 100644 --- a/src/minecraft/assemblyline/common/machine/armbot/TileEntityArmbot.java +++ b/src/minecraft/assemblyline/common/machine/armbot/TileEntityArmbot.java @@ -38,6 +38,7 @@ import assemblyline.common.machine.command.CommandGrab; import assemblyline.common.machine.command.CommandManager; import assemblyline.common.machine.command.CommandReturn; import assemblyline.common.machine.command.CommandRotate; +import assemblyline.common.machine.command.CommandUse; import assemblyline.common.machine.encoder.ItemDisk; import com.google.common.io.ByteArrayDataInput; @@ -559,7 +560,7 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult @Override public String[] getMethodNames() { - return new String[] { "rotate", "grab", "drop", "reset", "isWorking", "touchingEntity" }; + return new String[] { "rotate", "grab", "drop", "reset", "isWorking", "touchingEntity", "use" }; } @Override @@ -625,6 +626,11 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult return new Object[] { false }; } + case 6: + { + this.commandManager.addCommand(this, CommandUse.class); + break; + } } return null; } diff --git a/src/minecraft/assemblyline/common/machine/command/Command.java b/src/minecraft/assemblyline/common/machine/command/Command.java index 221f0f201..e39200568 100644 --- a/src/minecraft/assemblyline/common/machine/command/Command.java +++ b/src/minecraft/assemblyline/common/machine/command/Command.java @@ -32,6 +32,7 @@ public abstract class Command registerCommand("rotate", CommandRotate.class); registerCommand("return", CommandReturn.class); registerCommand("repeat", CommandRepeat.class); + registerCommand("use", CommandUse.class); } public static void registerCommand(String command, Class commandClass) diff --git a/src/minecraft/assemblyline/common/machine/command/CommandUse.java b/src/minecraft/assemblyline/common/machine/command/CommandUse.java new file mode 100644 index 000000000..accb2ffc0 --- /dev/null +++ b/src/minecraft/assemblyline/common/machine/command/CommandUse.java @@ -0,0 +1,25 @@ +package assemblyline.common.machine.command; + +import net.minecraft.entity.Entity; +import net.minecraft.tileentity.TileEntity; +import assemblyline.common.machine.armbot.IUseable; + +public class CommandUse extends Command +{ + @Override + protected boolean doTask() + { + TileEntity handTile = this.tileEntity.getHandPosition().getTileEntity(this.world); + Entity handEntity = null; + if (this.tileEntity.grabbedEntities.size() > 0) + handEntity = this.tileEntity.grabbedEntities.get(0); + if (handTile != null) + { + if (handTile instanceof IUseable) + { + ((IUseable) handTile).onUse(this.tileEntity, handEntity); + } + } + return false; + } +}