Why does the game crashed when the book is opened? PHP: $p = $e->getPlayer();$book = Item::get(Item::WRITTEN_BOOK, 0, 1);$nbt = new CompoundTag("", []);$nbt->author = new StringTag("author", "author");$nbt->title = new StringTag("title", "title");$pages = [ new StringTag("page1", 'text1'), new StringTag("page2", 'text2')];$nbt->pages = new ListTag("pages", $pages);$book->setCompoundTag($nbt);$p->getInventory()->addItem($book);
You have to register your own written book item class since there's no class for it in pocketmine yet. ... https://minecraft.gamepedia.com/Written_Book
That's for PC. NOTE that PC's nbt keys aren't always the same as PE's. I can give several instances to support my argument.
I agree on that. But for data packets: how would a packet apply to a written book? It doesn't make sense unless written books now have UUIDs.
BookEditPacket could be your answer. I can assure you books use packets just like maps do. The NBT probably stores the text information but requires BookEditPacket to be sent to the client for viewing the written text and signature.