1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved Change block only for one player #2

Discussion in 'Development' started by yuko fuyutsuki, Mar 27, 2018.

  1. yuko fuyutsuki

    yuko fuyutsuki Slime

    Messages:
    77
    GitHub:
    fuyutsuki
    Hi developpers!
    I used
    PHP:
    /**
     * I defined below
     * @param Level   $level
     * @param Player  $player
     * @param Block[] $blocks
     */
    $level->sendBlocks([$player], $blocks);
    because I read this thread and wanted to do the same, but it does not work.
    Does an alternative method exist?
     
    Last edited: Mar 28, 2018
  2. xXNiceAssassinlo YT

    xXNiceAssassinlo YT Zombie Pigman

    Messages:
    499
    GitHub:
    xXNiceYT
    I don’t think u need instance
     
  3. yuko fuyutsuki

    yuko fuyutsuki Slime

    Messages:
    77
    GitHub:
    fuyutsuki
    Fixed
     
  4. MioTaku

    MioTaku Witch

    Messages:
    69
    GitHub:
    uselesswaifu
    What code did you use? That should work.
     
  5. korado531m7

    korado531m7 Slime

    Messages:
    77
    GitHub:
    korado531m7
    the code which you use is solid block? can we stand on it?
     
  6. yuko fuyutsuki

    yuko fuyutsuki Slime

    Messages:
    77
    GitHub:
    fuyutsuki
    Of cause
     
  7. yuko fuyutsuki

    yuko fuyutsuki Slime

    Messages:
    77
    GitHub:
    fuyutsuki
    Only this, but the code isnt work...
     
  8. korado531m7

    korado531m7 Slime

    Messages:
    77
    GitHub:
    korado531m7
    why don't you send with AddEntityPacket?
    you need to be an solid block?
     
  9. yuko fuyutsuki

    yuko fuyutsuki Slime

    Messages:
    77
    GitHub:
    fuyutsuki
    No, I dont want to send a block entity.
    What I want to send is an apparent fake block for a single player.
     
  10. korado531m7

    korado531m7 Slime

    Messages:
    77
    GitHub:
    korado531m7
    You can send block entity with AddEntityPacket (but it need to set metadata for it)
     
  11. yuko fuyutsuki

    yuko fuyutsuki Slime

    Messages:
    77
    GitHub:
    fuyutsuki
    I DONT WANT TO SEND BLOCK ENTITY.
     
  12. korado531m7

    korado531m7 Slime

    Messages:
    77
    GitHub:
    korado531m7
    sorry.. i missed it
     
  13. MioTaku

    MioTaku Witch

    Messages:
    69
    GitHub:
    uselesswaifu
    The code should work.
     
  14. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    PHP:
    $packet = new \pocketmine\network\mcpe\protocol\UpdateBlockPacket;
    $packet->$x;
    $packet->$y;
    $packet->$z;
    $packet->blockId $blockId;
    $packet->blockData $blockDamage;
    $player->dataPacket($packet);
     
    yuko fuyutsuki likes this.
  15. yuko fuyutsuki

    yuko fuyutsuki Slime

    Messages:
    77
    GitHub:
    fuyutsuki
    Actually, it did not work in my environment.
     
  16. yuko fuyutsuki

    yuko fuyutsuki Slime

    Messages:
    77
    GitHub:
    fuyutsuki
    Thank you, that code worked.
    However, clicking will cause the chunk to be reloaded and disappear. Is there a way to avoid it?
     
  17. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Listen to PlayerInteractEvent when action = PlauerInteractEvent::LEFT_CLICK_BLOCK and send the packet during the event also.
     
  18. yuko fuyutsuki

    yuko fuyutsuki Slime

    Messages:
    77
    GitHub:
    fuyutsuki
    Thank you, it worked
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.