PHP: $player = $this->getServer()->getPlayer("Player");$player->getLevel()->setBlock(new Vector3($player->x + 1, $player->y + 1, $player->z), new BlockName()); For BlockName, you can choose the block that you want to set by changing it from BlockName to an actual block. Also, make sure you're using the block... PHP: use pocketmine\block\BlockName;
Thank you but I think I found the solution. Your code works but it does not always put the block in the left of the player. So I calculate the coordinates (North, East , West, South ) depending on the orientation of the player's head with the function $player->getLocation()->getYaw() and I have set This to 360° ^^
https://github.com/PocketMine/Pocketmine-mp/blob/master/src/pocketmine/entity/Entity.php#L969 Modify this code a bit to change north to west, west to south, etc. PHP: function getLeft(Player $player) : int{ $rotation = ($yaw - 90) % 360; if($rotation < 0){ $rotation += 360.0; } if((0 <= $rotation and $rotation < 45) or (315 <= $rotation and $rotation < 360)){ return Vector3::SIDE_WEST; }elseif(45 <= $rotation and $rotation < 135){ return Vector3::SIDE_NORTH; }elseif(135 <= $rotation and $rotation < 225){ return Vector3::SIDE_EAST; }elseif(225 <= $rotation and $rotation < 315){ return Vector3::SIDE_SOUTH; }else{ throw new RuntimeException(); }}$player->getLevel()->setBlock($player->getSide(getLeft($player), 2), $block);