42 $this->type = Byte::readUnsigned($in);
43 $this->inventorySlot = Byte::readUnsigned($in);
46 case self::TYPE_REPLACE_PAGE:
47 case self::TYPE_ADD_PAGE:
48 $this->pageNumber = Byte::readUnsigned($in);
49 $this->text = CommonTypes::getString($in);
50 $this->photoName = CommonTypes::getString($in);
52 case self::TYPE_DELETE_PAGE:
53 $this->pageNumber = Byte::readUnsigned($in);
55 case self::TYPE_SWAP_PAGES:
56 $this->pageNumber = Byte::readUnsigned($in);
57 $this->secondaryPageNumber = Byte::readUnsigned($in);
59 case self::TYPE_SIGN_BOOK:
60 $this->title = CommonTypes::getString($in);
61 $this->author = CommonTypes::getString($in);
62 $this->xuid = CommonTypes::getString($in);
70 Byte::writeUnsigned($out, $this->type);
71 Byte::writeUnsigned($out, $this->inventorySlot);
74 case self::TYPE_REPLACE_PAGE:
75 case self::TYPE_ADD_PAGE:
76 Byte::writeUnsigned($out, $this->pageNumber);
77 CommonTypes::putString($out, $this->text);
78 CommonTypes::putString($out, $this->photoName);
80 case self::TYPE_DELETE_PAGE:
81 Byte::writeUnsigned($out, $this->pageNumber);
83 case self::TYPE_SWAP_PAGES:
84 Byte::writeUnsigned($out, $this->pageNumber);
85 Byte::writeUnsigned($out, $this->secondaryPageNumber);
87 case self::TYPE_SIGN_BOOK:
88 CommonTypes::putString($out, $this->title);
89 CommonTypes::putString($out, $this->author);
90 CommonTypes::putString($out, $this->xuid);
93 throw new \InvalidArgumentException(
"Unknown book edit type $this->type!");