129 private const MAX_FORM_RESPONSE_DEPTH = 2;
131 protected float $lastRightClickTime = 0.0;
134 protected ?
Vector3 $lastPlayerAuthInputPosition =
null;
135 protected ?
float $lastPlayerAuthInputYaw =
null;
136 protected ?
float $lastPlayerAuthInputPitch =
null;
137 protected ?
BitSet $lastPlayerAuthInputFlags =
null;
141 public bool $forceMoveSync =
false;
143 protected ?
string $lastRequestedFullSkinId =
null;
145 public function __construct(
151 public function handleText(
TextPacket $packet) :
bool{
152 if($packet->type === TextPacket::TYPE_CHAT){
153 return $this->player->chat($packet->message);
165 private function resolveOnOffInputFlags(
BitSet $inputFlags,
int $startFlag,
int $stopFlag) : ?
bool{
166 $enabled = $inputFlags->get($startFlag);
167 $disabled = $inputFlags->get($stopFlag);
168 if($enabled !== $disabled){
176 $rawPos = $packet->getPosition();
177 $rawYaw = $packet->getYaw();
178 $rawPitch = $packet->getPitch();
179 foreach([$rawPos->x, $rawPos->y, $rawPos->z, $rawYaw, $packet->getHeadYaw(), $rawPitch] as $float){
180 if(is_infinite($float) || is_nan($float)){
181 $this->session->getLogger()->debug(
"Invalid movement received, contains NAN/INF components");
186 if($rawYaw !== $this->lastPlayerAuthInputYaw || $rawPitch !== $this->lastPlayerAuthInputPitch){
187 $this->lastPlayerAuthInputYaw = $rawYaw;
188 $this->lastPlayerAuthInputPitch = $rawPitch;
190 $yaw = fmod($rawYaw, 360);
191 $pitch = fmod($rawPitch, 360);
196 $this->player->setRotation($yaw, $pitch);
199 $hasMoved = $this->lastPlayerAuthInputPosition ===
null || !$this->lastPlayerAuthInputPosition->equals($rawPos);
200 $newPos = $rawPos->subtract(0, 1.62, 0)->round(4);
202 if($this->forceMoveSync && $hasMoved){
203 $curPos = $this->player->getLocation();
205 if($newPos->distanceSquared($curPos) > 1){
206 $this->session->getLogger()->debug(
"Got outdated pre-teleport movement, received " . $newPos .
", expected " . $curPos);
212 $this->forceMoveSync =
false;
215 $inputFlags = $packet->getInputFlags();
216 if($this->lastPlayerAuthInputFlags ===
null || !$inputFlags->equals($this->lastPlayerAuthInputFlags)){
217 $this->lastPlayerAuthInputFlags = $inputFlags;
220 if($this->player->isSneaking() === $sneaking){
223 $sprinting = $this->resolveOnOffInputFlags($inputFlags, PlayerAuthInputFlags::START_SPRINTING, PlayerAuthInputFlags::STOP_SPRINTING);
224 $swimming = $this->resolveOnOffInputFlags($inputFlags, PlayerAuthInputFlags::START_SWIMMING, PlayerAuthInputFlags::STOP_SWIMMING);
225 $gliding = $this->resolveOnOffInputFlags($inputFlags, PlayerAuthInputFlags::START_GLIDING, PlayerAuthInputFlags::STOP_GLIDING);
226 $flying = $this->resolveOnOffInputFlags($inputFlags, PlayerAuthInputFlags::START_FLYING, PlayerAuthInputFlags::STOP_FLYING);
228 ($sneaking !==
null && !$this->player->toggleSneak($sneaking)) |
229 ($sprinting !==
null && !$this->player->toggleSprint($sprinting)) |
230 ($swimming !==
null && !$this->player->toggleSwim($swimming)) |
231 ($gliding !==
null && !$this->player->toggleGlide($gliding)) |
232 ($flying !==
null && !$this->player->toggleFlight($flying));
233 if((
bool) $mismatch){
234 $this->player->sendData([$this->player]);
238 $this->player->jump();
241 $this->player->missSwing();
245 if(!$this->forceMoveSync && $hasMoved){
246 $this->lastPlayerAuthInputPosition = $rawPos;
248 $this->player->handleMovement($newPos);
251 $packetHandled =
true;
253 $useItemTransaction = $packet->getItemInteractionData();
254 if($useItemTransaction !==
null){
255 if(count($useItemTransaction->getTransactionData()->getActions()) > 100){
259 $this->inventoryManager->setCurrentItemStackRequestId($useItemTransaction->getRequestId());
260 $this->inventoryManager->addRawPredictedSlotChanges($useItemTransaction->getTransactionData()->getActions());
261 if(!$this->handleUseItemTransaction($useItemTransaction->getTransactionData())){
262 $packetHandled =
false;
263 $this->session->getLogger()->debug(
"Unhandled transaction in PlayerAuthInputPacket (type " . $useItemTransaction->getTransactionData()->getActionType() .
")");
265 $this->inventoryManager->syncMismatchedPredictedSlotChanges();
267 $this->inventoryManager->setCurrentItemStackRequestId(
null);
270 $itemStackRequest = $packet->getItemStackRequest();
271 $itemStackResponseBuilder = $itemStackRequest !==
null ? $this->handleSingleItemStackRequest($itemStackRequest) :
null;
275 $blockActions = $packet->getBlockActions();
276 if($blockActions !==
null){
277 if(count($blockActions) > 100){
280 foreach(Utils::promoteKeys($blockActions) as $k => $blockAction){
281 $actionHandled =
false;
283 $actionHandled = $this->handlePlayerActionFromData($blockAction->getActionType(),
new BlockPosition(0, 0, 0), Facing::DOWN);
285 $actionHandled = $this->handlePlayerActionFromData($blockAction->getActionType(), $blockAction->getBlockPosition(), $blockAction->getFace());
289 $packetHandled =
false;
290 $this->session->getLogger()->debug(
"Unhandled player block action at offset $k in PlayerAuthInputPacket");
295 if($itemStackRequest !==
null){
296 $itemStackResponse = $itemStackResponseBuilder?->build() ??
new ItemStackResponse(ItemStackResponse::RESULT_ERROR, $itemStackRequest->getRequestId());
300 return $packetHandled;
304 if($packet->actorRuntimeId !== $this->player->getId()){
306 return $packet->actorRuntimeId === ActorEvent::EATING_ITEM;
309 switch($packet->eventId){
310 case ActorEvent::EATING_ITEM:
311 $item = $this->player->getInventory()->getItemInHand();
315 $this->player->broadcastAnimation(
new ConsumingItemAnimation($this->player, $this->player->getInventory()->getItemInHand()));
327 if(count($packet->trData->getActions()) > 50){
330 if(count($packet->requestChangedSlots) > 10){
334 $this->inventoryManager->setCurrentItemStackRequestId($packet->requestId);
335 $this->inventoryManager->addRawPredictedSlotChanges($packet->trData->getActions());
338 $result = $this->handleNormalTransaction($packet->trData, $packet->requestId);
340 $this->session->getLogger()->debug(
"Mismatch transaction received");
341 $this->inventoryManager->requestSyncAll();
344 $result = $this->handleUseItemTransaction($packet->trData);
346 $result = $this->handleUseItemOnEntityTransaction($packet->trData);
348 $result = $this->handleReleaseItemTransaction($packet->trData);
351 $this->inventoryManager->syncMismatchedPredictedSlotChanges();
357 foreach($packet->requestChangedSlots as $containerInfo){
358 foreach($containerInfo->getChangedSlotIndexes() as $netSlot){
360 $inventoryAndSlot = $this->inventoryManager->locateWindowAndSlot($windowId, $slot);
361 if($inventoryAndSlot !==
null){
362 $this->inventoryManager->onSlotChange($inventoryAndSlot[0], $inventoryAndSlot[1]);
367 $this->inventoryManager->setCurrentItemStackRequestId(
null);
371 private function executeInventoryTransaction(
InventoryTransaction $transaction,
int $requestId) :
bool{
372 $this->player->setUsingItem(
false);
374 $this->inventoryManager->setCurrentItemStackRequestId($requestId);
375 $this->inventoryManager->addTransactionPredictedSlotChanges($transaction);
379 $this->inventoryManager->requestSyncAll();
380 $logger = $this->session->getLogger();
381 $logger->debug(
"Invalid inventory transaction $requestId: " . $e->getMessage());
385 $this->session->getLogger()->debug(
"Inventory transaction $requestId cancelled by a plugin");
389 $this->inventoryManager->syncMismatchedPredictedSlotChanges();
390 $this->inventoryManager->setCurrentItemStackRequestId(
null);
396 private function handleNormalTransaction(
NormalTransactionData $data,
int $itemStackRequestId) :
bool{
403 if($actionCount > 2){
404 if($actionCount > 5){
410 $this->session->getLogger()->debug(
"Ignoring normal inventory transaction with $actionCount actions (drop-item should have exactly 2 actions)");
415 $clientItemStack =
null;
416 $droppedCount =
null;
418 foreach($data->
getActions() as $networkInventoryAction){
419 if($networkInventoryAction->sourceType === NetworkInventoryAction::SOURCE_WORLD && $networkInventoryAction->inventorySlot === NetworkInventoryAction::ACTION_MAGIC_SLOT_DROP_ITEM){
420 $droppedCount = $networkInventoryAction->newItem->getItemStack()->getCount();
421 if($droppedCount <= 0){
424 }elseif($networkInventoryAction->sourceType === NetworkInventoryAction::SOURCE_CONTAINER && $networkInventoryAction->windowId === ContainerIds::INVENTORY){
426 $sourceSlot = $networkInventoryAction->inventorySlot;
427 $clientItemStack = $networkInventoryAction->oldItem->getItemStack();
429 $this->session->getLogger()->debug(
"Unexpected inventory action type $networkInventoryAction->sourceType in drop item transaction");
433 if($sourceSlot ===
null || $clientItemStack ===
null || $droppedCount ===
null){
434 $this->session->getLogger()->debug(
"Missing information in drop item transaction, need source slot, client item stack and dropped count");
438 $inventory = $this->player->getInventory();
440 if(!$inventory->slotExists($sourceSlot)){
444 $sourceSlotItem = $inventory->getItem($sourceSlot);
445 if($sourceSlotItem->getCount() < $droppedCount){
448 $serverItemStack = $this->session->getTypeConverter()->coreItemStackToNet($sourceSlotItem);
452 $serverItemStack->getId() !== $clientItemStack->getId() ||
453 $serverItemStack->getMeta() !== $clientItemStack->getMeta() ||
454 $serverItemStack->getCount() !== $clientItemStack->getCount() ||
455 $serverItemStack->getBlockRuntimeId() !== $clientItemStack->getBlockRuntimeId()
465 $droppedItem = $sourceSlotItem->pop($droppedCount);
468 $builder->getInventory($inventory)->setItem($sourceSlot, $sourceSlotItem);
472 return $this->executeInventoryTransaction($transaction, $itemStackRequestId);
476 $this->player->selectHotbarSlot($data->getHotbarSlot());
478 switch($data->getActionType()){
479 case UseItemTransactionData::ACTION_CLICK_BLOCK:
481 $clickPos = $data->getClickPosition();
482 $spamBug = ($this->lastRightClickData !==
null &&
483 microtime(
true) - $this->lastRightClickTime < 0.1 &&
484 $this->lastRightClickData->getPlayerPosition()->distanceSquared($data->getPlayerPosition()) < 0.00001 &&
485 $this->lastRightClickData->getBlockPosition()->equals($data->getBlockPosition()) &&
486 $this->lastRightClickData->getClickPosition()->distanceSquared($clickPos) < 0.00001
489 $this->lastRightClickData = $data;
490 $this->lastRightClickTime = microtime(
true);
496 self::validateFacing($data->getFace());
498 $blockPos = $data->getBlockPosition();
499 $vBlockPos =
new Vector3($blockPos->getX(), $blockPos->getY(), $blockPos->getZ());
500 $this->player->interactBlock($vBlockPos, $data->getFace(), $clickPos);
505 $this->syncBlocksNearby($vBlockPos, $data->getFace());
507 case UseItemTransactionData::ACTION_CLICK_AIR:
508 if($this->player->isUsingItem()){
509 if(!$this->player->consumeHeldItem()){
510 $hungerAttr = $this->player->getAttributeMap()->get(Attribute::HUNGER) ??
throw new AssumptionFailedError();
511 $hungerAttr->markSynchronized(
false);
515 $this->player->useHeldItem();
525 private static function validateFacing(
int $facing) :
void{
526 if(!in_array($facing, Facing::ALL,
true)){
534 private function syncBlocksNearby(
Vector3 $blockPos, ?
int $face) :
void{
535 if($blockPos->distanceSquared($this->player->getLocation()) < 10000){
538 $sidePos = $blockPos->
getSide($face);
541 array_push($blocks, ...$sidePos->sidesArray());
543 $blocks[] = $blockPos;
545 foreach($this->player->getWorld()->createBlockUpdatePackets($blocks) as $packet){
546 $this->session->sendDataPacket($packet);
552 $target = $this->player->getWorld()->getEntity($data->getActorRuntimeId());
553 if($target ===
null){
557 $this->player->selectHotbarSlot($data->getHotbarSlot());
559 switch($data->getActionType()){
560 case UseItemOnEntityTransactionData::ACTION_INTERACT:
561 $this->player->interactEntity($target, $data->getClickPosition());
563 case UseItemOnEntityTransactionData::ACTION_ATTACK:
564 $this->player->attackEntity($target);
572 $this->player->selectHotbarSlot($data->getHotbarSlot());
574 if($data->getActionType() === ReleaseItemTransactionData::ACTION_RELEASE){
575 $this->player->releaseHeldItem();
598 $transaction = $executor->generateInventoryTransaction();
599 if($transaction !==
null){
600 $result = $this->executeInventoryTransaction($transaction, $request->getRequestId());
606 $this->session->getLogger()->debug(
"ItemStackRequest #" . $request->getRequestId() .
" failed: " . $e->getMessage());
607 $this->session->getLogger()->debug(implode(
"\n", Utils::printableExceptionInfo($e)));
608 $this->inventoryManager->requestSyncAll();
611 return $result ? $executor->getItemStackResponseBuilder() :
null;
616 if(count($packet->getRequests()) > 80){
620 foreach($packet->getRequests() as $request){
621 $responses[] = $this->handleSingleItemStackRequest($request)?->build() ??
new ItemStackResponse(ItemStackResponse::RESULT_ERROR, $request->getRequestId());
630 if($packet->windowId === ContainerIds::OFFHAND){
633 if($packet->windowId === ContainerIds::INVENTORY){
634 $this->inventoryManager->onClientSelectHotbarSlot($packet->hotbarSlot);
635 if(!$this->player->selectHotbarSlot($packet->hotbarSlot)){
636 $this->inventoryManager->syncSelectedHotbarSlot();
648 if($packet->action === InteractPacket::ACTION_MOUSEOVER){
656 $target = $this->player->getWorld()->getEntity($packet->targetActorRuntimeId);
657 if($target ===
null){
660 if($packet->action === InteractPacket::ACTION_OPEN_INVENTORY && $target === $this->player){
661 $this->inventoryManager->onClientOpenMainInventory();
668 return $this->player->pickBlock(
new Vector3($packet->blockPosition->getX(), $packet->blockPosition->getY(), $packet->blockPosition->getZ()), $packet->addUserData);
672 return $this->player->pickEntity($packet->actorUniqueId);
676 return $this->handlePlayerActionFromData($packet->action, $packet->blockPosition, $packet->face);
679 private function handlePlayerActionFromData(
int $action,
BlockPosition $blockPosition,
int $face) :
bool{
680 $pos =
new Vector3($blockPosition->getX(), $blockPosition->getY(), $blockPosition->getZ());
683 case PlayerAction::START_BREAK:
684 case PlayerAction::CONTINUE_DESTROY_BLOCK:
685 self::validateFacing($face);
686 if($this->lastBlockAttacked !==
null && $blockPosition->equals($this->lastBlockAttacked)){
691 $this->session->getLogger()->debug(
"Ignoring PlayerAction $action on $pos because we were already destroying this block");
694 if(!$this->player->attackBlock($pos, $face)){
695 $this->syncBlocksNearby($pos, $face);
697 $this->lastBlockAttacked = $blockPosition;
701 case PlayerAction::ABORT_BREAK:
702 case PlayerAction::STOP_BREAK:
703 $this->player->stopBreakBlock($pos);
704 $this->lastBlockAttacked =
null;
706 case PlayerAction::START_SLEEPING:
709 case PlayerAction::STOP_SLEEPING:
710 $this->player->stopSleep();
712 case PlayerAction::CRACK_BREAK:
713 self::validateFacing($face);
714 $this->player->continueBreakBlock($pos, $face);
715 $this->lastBlockAttacked = $blockPosition;
717 case PlayerAction::INTERACT_BLOCK:
719 case PlayerAction::CREATIVE_PLAYER_DESTROY_BLOCK:
721 case PlayerAction::PREDICT_DESTROY_BLOCK:
722 self::validateFacing($face);
723 if(!$this->player->breakBlock($pos)){
724 $this->syncBlocksNearby($pos, $face);
726 $this->lastBlockAttacked =
null;
728 case PlayerAction::START_ITEM_USE_ON:
729 case PlayerAction::STOP_ITEM_USE_ON:
733 $this->session->getLogger()->debug(
"Unhandled/unknown player action type " . $action);
737 $this->player->setUsingItem(
false);
751 $this->inventoryManager->onClientRemoveWindow($packet->windowId);
760 $pos =
new Vector3($packet->blockPosition->getX(), $packet->blockPosition->getY(), $packet->blockPosition->getZ());
761 if($pos->distanceSquared($this->player->getLocation()) > 10000){
765 $block = $this->player->getLocation()->getWorld()->getBlock($pos);
766 $nbt = $packet->nbt->getRoot();
770 $frontTextTag = $nbt->getTag(Sign::TAG_FRONT_TEXT);
772 throw new PacketHandlingException(
"Invalid tag type " . get_debug_type($frontTextTag) .
" for tag \"" . Sign::TAG_FRONT_TEXT .
"\" in sign update data");
774 $textBlobTag = $frontTextTag->getTag(Sign::TAG_TEXT_BLOB);
776 throw new PacketHandlingException(
"Invalid tag type " . get_debug_type($textBlobTag) .
" for tag \"" . Sign::TAG_TEXT_BLOB .
"\" in sign update data");
780 $text = SignText::fromBlob($textBlobTag->getValue());
781 }
catch(\InvalidArgumentException $e){
782 throw PacketHandlingException::wrap($e,
"Invalid sign text update");
786 if(!$block->updateText($this->player, $text)){
787 foreach($this->player->getWorld()->createBlockUpdatePackets([$pos]) as $updatePacket){
788 $this->session->sendDataPacket($updatePacket);
791 }
catch(\UnexpectedValueException $e){
792 throw PacketHandlingException::wrap($e);
802 $gameMode = $this->session->getTypeConverter()->protocolGameModeToCore($packet->gamemode);
803 if($gameMode !== $this->player->getGamemode()){
805 $this->session->syncGameMode($this->player->getGamemode(),
true);
819 $this->player->setViewDistance($packet->radius);
833 if(str_starts_with($packet->command,
'/')){
834 $this->player->chat($packet->command);
845 if($packet->skin->getFullSkinId() === $this->lastRequestedFullSkinId){
848 $this->session->getLogger()->debug(
"Refused duplicate skin change request");
851 $this->lastRequestedFullSkinId = $packet->skin->getFullSkinId();
853 $this->session->getLogger()->debug(
"Processing skin change request");
855 $skin = $this->session->getTypeConverter()->getSkinAdapter()->fromSkinData($packet->skin);
857 throw PacketHandlingException::wrap($e,
"Invalid skin in PlayerSkinPacket");
859 return $this->player->changeSkin($skin, $packet->newSkinName, $packet->oldSkinName);
869 private function checkBookText(
string $string,
string $fieldName,
int $softLimit,
int $hardLimit,
bool &$cancel) :
string{
870 if(strlen($string) > $hardLimit){
871 throw new PacketHandlingException(sprintf(
"Book %s must be at most %d bytes, but have %d bytes", $fieldName, $hardLimit, strlen($string)));
874 $result = TextFormat::clean($string,
false);
876 if(strlen($result) > $softLimit * 4 || mb_strlen($result,
'UTF-8') > $softLimit){
878 $this->session->getLogger()->debug(
"Cancelled book edit due to $fieldName exceeded soft limit of $softLimit chars");
885 $inventory = $this->player->getInventory();
886 if(!$inventory->slotExists($packet->inventorySlot)){
890 $oldBook = $inventory->getItem($packet->inventorySlot);
895 $newBook = clone $oldBook;
898 switch($packet->type){
899 case BookEditPacket::TYPE_REPLACE_PAGE:
900 $text = self::checkBookText($packet->text,
"page text", 256, WritableBookPage::PAGE_LENGTH_HARD_LIMIT_BYTES, $cancel);
901 $newBook->setPageText($packet->pageNumber, $text);
902 $modifiedPages[] = $packet->pageNumber;
904 case BookEditPacket::TYPE_ADD_PAGE:
905 if(!$newBook->pageExists($packet->pageNumber)){
910 $text = self::checkBookText($packet->text,
"page text", 256, WritableBookPage::PAGE_LENGTH_HARD_LIMIT_BYTES, $cancel);
911 $newBook->insertPage($packet->pageNumber, $text);
912 $modifiedPages[] = $packet->pageNumber;
914 case BookEditPacket::TYPE_DELETE_PAGE:
915 if(!$newBook->pageExists($packet->pageNumber)){
918 $newBook->deletePage($packet->pageNumber);
919 $modifiedPages[] = $packet->pageNumber;
921 case BookEditPacket::TYPE_SWAP_PAGES:
922 if(!$newBook->pageExists($packet->pageNumber) || !$newBook->pageExists($packet->secondaryPageNumber)){
924 $newBook->addPage(max($packet->pageNumber, $packet->secondaryPageNumber));
926 $newBook->swapPages($packet->pageNumber, $packet->secondaryPageNumber);
927 $modifiedPages = [$packet->pageNumber, $packet->secondaryPageNumber];
929 case BookEditPacket::TYPE_SIGN_BOOK:
930 $title = self::checkBookText($packet->title,
"title", 16, Limits::INT16_MAX, $cancel);
932 $author = self::checkBookText($packet->author,
"author", 256, Limits::INT16_MAX, $cancel);
934 $newBook = VanillaItems::WRITTEN_BOOK()
935 ->setPages($oldBook->getPages())
938 ->setGeneration(WrittenBook::GENERATION_ORIGINAL);
945 $action = match($packet->type){
946 BookEditPacket::TYPE_REPLACE_PAGE => PlayerEditBookEvent::ACTION_REPLACE_PAGE,
947 BookEditPacket::TYPE_ADD_PAGE => PlayerEditBookEvent::ACTION_ADD_PAGE,
948 BookEditPacket::TYPE_DELETE_PAGE => PlayerEditBookEvent::ACTION_DELETE_PAGE,
949 BookEditPacket::TYPE_SWAP_PAGES => PlayerEditBookEvent::ACTION_SWAP_PAGES,
950 BookEditPacket::TYPE_SIGN_BOOK => PlayerEditBookEvent::ACTION_SIGN_BOOK,
958 $oldPageCount = count($oldBook->getPages());
959 $newPageCount = count($newBook->getPages());
960 if(($newPageCount > $oldPageCount && $newPageCount > 50)){
961 $this->session->getLogger()->debug(
"Cancelled book edit due to adding too many pages (new page count would be $newPageCount)");
965 $event =
new PlayerEditBookEvent($this->player, $oldBook, $newBook, $action, $modifiedPages);
971 if($event->isCancelled()){
975 $this->player->getInventory()->setItem($packet->inventorySlot, $event->getNewBook());
981 if($packet->cancelReason !==
null){
983 return $this->player->onFormSubmit($packet->formId,
null);
984 }elseif($packet->formData !==
null){
986 $responseData = json_decode($packet->formData,
true, self::MAX_FORM_RESPONSE_DEPTH, JSON_THROW_ON_ERROR);
987 }
catch(\JsonException $e){
988 throw PacketHandlingException::wrap($e,
"Failed to decode form response data");
990 return $this->player->onFormSubmit($packet->formId, $responseData);
992 throw new PacketHandlingException(
"Expected either formData or cancelReason to be set in ModalFormResponsePacket");
1005 $pos = $packet->blockPosition;
1006 $chunkX = $pos->getX() >> Chunk::COORD_BIT_SIZE;
1007 $chunkZ = $pos->getZ() >> Chunk::COORD_BIT_SIZE;
1008 $world = $this->player->getWorld();
1009 if(!$world->isChunkLoaded($chunkX, $chunkZ) || $world->isChunkLocked($chunkX, $chunkZ)){
1013 $lectern = $world->getBlockAt($pos->getX(), $pos->getY(), $pos->getZ());
1014 if($lectern instanceof
Lectern && $this->player->canInteract($lectern->getPosition(), 15)){
1015 if(!$lectern->onPageTurn($packet->page)){
1016 $this->syncBlocksNearby($lectern->getPosition(),
null);
1038 public function handleEmote(
EmotePacket $packet) :
bool{
1039 $this->player->emote($packet->getEmoteId());