diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index b9809f763..14f1c4c10 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -2416,18 +2416,21 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade } public function handleBlockPickRequest(BlockPickRequestPacket $packet) : bool{ - $tile = $this->getLevel()->getTile($this->temporalVector->setComponents($packet->tileX, $packet->tileY, $packet->tileZ)); - if($tile instanceof Tile){ //TODO: check if the held item matches the target tile - $nbt = $tile->getCleanedNBT(); - if($nbt instanceof CompoundTag){ - $item = $this->inventory->getItemInHand(); - $item->setCustomBlockData($nbt); - $item->setLore(["+(DATA)"]); - $this->inventory->setItemInHand($item); - } + if($this->isCreative()){ + $tile = $this->getLevel()->getTile($this->temporalVector->setComponents($packet->tileX, $packet->tileY, $packet->tileZ)); + if($tile instanceof Tile){ //TODO: check if the held item matches the target tile + $nbt = $tile->getCleanedNBT(); + if($nbt instanceof CompoundTag){ + $item = $this->inventory->getItemInHand(); + $item->setCustomBlockData($nbt); + $item->setLore(["+(DATA)"]); + $this->inventory->setItemInHand($item); + } - return true; + return true; + } } + return false; }