(slot, pages, author, title, signing)
| 59 | } |
| 60 | |
| 61 | function modifyBook (slot, pages, author, title, signing) { |
| 62 | const book = Object.assign({}, bot.inventory.slots[slot]) |
| 63 | if (!book.nbt || book.nbt.type !== 'compound') { |
| 64 | book.nbt = { |
| 65 | type: 'compound', |
| 66 | name: '', |
| 67 | value: {} |
| 68 | } |
| 69 | } |
| 70 | if (signing) { |
| 71 | if (bot.supportFeature('clientUpdateBookIdWhenSign')) { |
| 72 | book.type = bot.registry.itemsByName.written_book.id |
| 73 | } |
| 74 | book.nbt.value.author = { |
| 75 | type: 'string', |
| 76 | value: author |
| 77 | } |
| 78 | book.nbt.value.title = { |
| 79 | type: 'string', |
| 80 | value: title |
| 81 | } |
| 82 | } |
| 83 | book.nbt.value.pages = { |
| 84 | type: 'list', |
| 85 | value: { |
| 86 | type: 'string', |
| 87 | value: pages |
| 88 | } |
| 89 | } |
| 90 | bot.inventory.updateSlot(slot, book) |
| 91 | return book |
| 92 | } |
| 93 | |
| 94 | bot.writeBook = async (slot, pages) => { |
| 95 | await write(slot, pages, null, null, false) |
no outgoing calls
no test coverage detected
searching dependent graphs…