}
}
private void scanForItem() {
double previousDistance = Double.MAX_VALUE;
TransactorSimple inventoryInsert = new TransactorSimple(robot);
for (Object o : robot.worldObj.loadedEntityList) {
Entity e = (Entity) o;
if (!e.isDead
&& e instanceof EntityItem
&& !BoardRobotPicker.targettedItems.contains(e.getEntityId())
&& !robot.isKnownUnreachable(e)
&& (zone == null || zone.contains(e.posX, e.posY, e.posZ))) {
double dx = e.posX - robot.posX;
double dy = e.posY - robot.posY;
double dz = e.posZ - robot.posZ;
double sqrDistance = dx * dx + dy * dy + dz * dz;
double maxDistance = maxRange * maxRange;
if (sqrDistance >= maxDistance) {
continue;
} else if (stackFilter != null && !stackFilter.matches(((EntityItem) e).getEntityItem())) {
continue;
} else {
EntityItem item = (EntityItem) e;
if (inventoryInsert.inject(item.getEntityItem(), ForgeDirection.UNKNOWN, false) > 0) {
if (target == null) {
previousDistance = sqrDistance;
target = item;
} else {
if (sqrDistance < previousDistance) {