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

Chest

Discussion in 'Facepalm' started by LucGamesDE, May 30, 2017.

  1. LucGamesDE

    LucGamesDE Baby Zombie

    Messages:
    170
    Is there a way to keep the chest opened and close the inventory for the player if he opens a chest?
     
  2. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    You mean the chest opening animation? You can use BlockEventPacket. I'll update this post with how PMMP uses if I ever find it. XD
     
  3. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Open animation:
    PHP:
    /** @var Level $level */
    /** @var int $x */
    /** @var int $y */
    /** @var int $z */
    $pk = new BlockEventPacket();
    $pk->$x;
    $pk->$y;
    $pk->$z;
    $pk->case1 1;
    $pk->case2 2;
    $level->addChunkPacket($x >> 4$z >> 4$pk);
    Close animation:
    PHP:
    /** @var Level $level */
    /** @var int $x */
    /** @var int $y */
    /** @var int $z */
    $pk = new BlockEventPacket();
    $pk->$x;
    $pk->$y;
    $pk->$z;
    $pk->case1 1;
    $pk->case2 0;
    $level->addChunkPacket($x >> 4$z >> 4$pk);
     
    corytortoise and MyNET like this.
  4. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    Unless I'm mistaken, you can also broadcast the packet as you wish, such as to a single player with $player->dataPacket.
     
  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.