def set_item_data(item_name, item_data)
      index = @items.index item_name
      raise ArgumentError, 'Unknown item' unless index

      @mutex.synchronize { @data[index].set_data item_data, mode }
    end
def set_item_data(item_name, item_data)
      index = @items.index item_name
      raise ArgumentError, 'Unknown item' unless index

      @mutex.synchronize { @data[index].set_data item_data, mode }
    end
Sets the current data for the item with the specified name. This is only allowed when {mode} is `:command` or
 `:merge`. Raises an exception if the specified item name or item data is invalid.

 @param [String] item_name The name of the item to set the data for.
 @param [Hash, Array<Hash>] item_data The new data for the item. If {#mode} is `:merge` this must be a hash. If
        {#mode} is `:command` then this must be an `Array<Hash>` and each hash entry must have a unique `:key`
        value.