Improved armbot slightly

This commit is contained in:
Brian Ricketts 2013-01-14 15:35:29 -06:00
parent e0ef452563
commit 1fd05aade7

View file

@ -485,6 +485,11 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult
@Override @Override
public Object[] callMethod(IComputerAccess computer, int method, Object[] arguments) throws Exception public Object[] callMethod(IComputerAccess computer, int method, Object[] arguments) throws Exception
{ {
System.out.println(getMethodNames()[method] + ": ");
for (Object o : arguments)
{
System.out.println(" " + o.toString());
}
switch (method) switch (method)
{ {
case 0: // rotateBy: rotates by a certain amount case 0: // rotateBy: rotates by a certain amount
@ -511,13 +516,13 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult
{ {
if (arguments.length > 0) if (arguments.length > 0)
{ {
if (arguments[0] instanceof Float) try
{ {
float angle = (Float) arguments[0]; float angle = (Float) arguments[0];
float diff = angle - this.rotationYaw; float diff = angle - this.rotationYaw;
this.commandManager.addCommand(this, CommandRotate.class, new String[] { Float.toString(diff) }); this.commandManager.addCommand(this, CommandRotate.class, new String[] { Float.toString(diff) });
} }
else catch (Exception ex)
{ {
throw new IllegalArgumentException("expected number"); throw new IllegalArgumentException("expected number");
} }