diff --git a/src/main/scala/li/cil/oc/server/component/robot/Player.scala b/src/main/scala/li/cil/oc/server/component/robot/Player.scala index 57af9f22b..7a6cb7357 100644 --- a/src/main/scala/li/cil/oc/server/component/robot/Player.scala +++ b/src/main/scala/li/cil/oc/server/component/robot/Player.scala @@ -306,7 +306,7 @@ class Player(val robot: tileentity.Robot) extends EntityPlayer(robot.world, Sett }) } - private def isItemUseAllowed(stack: ItemStack) = { + private def isItemUseAllowed(stack: ItemStack) = stack == null || { (Settings.get.allowUseItemsWithDuration || stack.getMaxItemUseDuration <= 0) && (!PortalGun.isPortalGun(stack) || PortalGun.isStandardPortalGun(stack)) && !stack.isItemEqual(new ItemStack(Item.leash)) diff --git a/src/main/scala/li/cil/oc/server/component/robot/Robot.scala b/src/main/scala/li/cil/oc/server/component/robot/Robot.scala index 882c7ed0d..49af11d60 100644 --- a/src/main/scala/li/cil/oc/server/component/robot/Robot.scala +++ b/src/main/scala/li/cil/oc/server/component/robot/Robot.scala @@ -231,7 +231,8 @@ class Robot(val robot: tileentity.Robot) extends ManagedComponent { Iterable(checkSideForFace(args, 1, facing)) } else { - ForgeDirection.VALID_DIRECTIONS.filter(_ != facing.getOpposite).toIterable + // Always try the direction we're looking first. + Iterable(facing) ++ ForgeDirection.VALID_DIRECTIONS.filter(side => side != facing && side != facing.getOpposite).toIterable } val sneaky = args.isBoolean(2) && args.checkBoolean(2) val stack = player.robotInventory.selectedItemStack @@ -337,7 +338,8 @@ class Robot(val robot: tileentity.Robot) extends ManagedComponent { Iterable(checkSideForFace(args, 1, facing)) } else { - ForgeDirection.VALID_DIRECTIONS.filter(_ != facing.getOpposite).toIterable + // Always try the direction we're looking first. + Iterable(facing) ++ ForgeDirection.VALID_DIRECTIONS.filter(side => side != facing && side != facing.getOpposite).toIterable } val sneaky = args.isBoolean(2) && args.checkBoolean(2) @@ -414,7 +416,8 @@ class Robot(val robot: tileentity.Robot) extends ManagedComponent { Iterable(checkSideForFace(args, 1, facing)) } else { - ForgeDirection.VALID_DIRECTIONS.filter(_ != facing.getOpposite).toIterable + // Always try the direction we're looking first. + Iterable(facing) ++ ForgeDirection.VALID_DIRECTIONS.filter(side => side != facing && side != facing.getOpposite).toIterable } val sneaky = args.isBoolean(2) && args.checkBoolean(2) val duration =