@Override public SpellResult step(CastContext context) { Block attachBlock = context.getTargetBlock(); BlockFace direction = BlockFace.UP; Block targetBlock = attachBlock.getRelative(direction); int distance = 0; while (context.isTargetable(targetBlock) && distance <= MAX_SEARCH_DISTANCE) { distance++; attachBlock = targetBlock; targetBlock = attachBlock.getRelative(direction); } if (context.isTargetable(targetBlock)) { return SpellResult.NO_TARGET; } actionContext.setTargetLocation(targetBlock.getLocation()); context.getBrush().setTarget(attachBlock.getLocation(), targetBlock.getLocation()); return startActions(); }