Item.Book constructor

Item.Book(
  1. List<BookPage> pages, {
  2. String title = '',
  3. String author = '',
  4. int? count,
  5. Slot? slot,
  6. int? damage,
  7. int? model,
  8. int? hideFlags,
  9. TextComponent? name,
  10. List<TextComponent>? lore,
  11. Map<String, dynamic>? nbt,
})

Implementation

Item.Book(
  List<BookPage> pages, {
  String title = '',
  String author = '',
  this.count,
  this.slot,
  this.damage,
  int? model,
  int? hideFlags,
  TextComponent? name,
  List<TextComponent>? lore,
  Map<String, dynamic>? nbt,
})  : type = Items.written_book.toString(),
      tag = {} {
  nbt ??= {};
  nbt['title'] = title;
  nbt['author'] = author;
  nbt['pages'] = pages
      .map((page) =>
          json.encode(page.list.map((item) => item.toMap()).toList()))
      .toList();

  _checkTags(model, type, hideFlags, name, lore, nbt);
}