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

InventoryContentPacket

Discussion in 'Development' started by KielKing, Nov 22, 2018.

  1. KielKing

    KielKing Zombie

    Messages:
    245
    GitHub:
    kielking
    Hello PocketMine-MP Forums.

    I have an issue, my goal is to fill the container's inventory with a stone block but unfortunately that did not happen.

    This is the code i used:

    PHP:
    /* @var Player $this->player */
    /* @var Vector3 $this->pos */
    $pk1 = new ContainerOpenPacket();
    $pk1->windowId WindowTypes::MINECART_CHEST;
    $pk1->type WindowTypes::CONTAINER;
    $pk1->$this->pos->x;
    $pk1->$this->pos->y;
    $pk1->$this->pos->z;
    $this->player->sendDataPacket($pk1);

    $pk2 = new InventoryContentPacket();
    $pk2->windowId =  WindowTypes::MINECART_CHEST;
    $pk2->items array_fill(02Item::get(Item::AIR00));
    $pk2->items[3] = Item::get(Item::STONE04);
    $this->player->sendDataPacket($pk2);
    Does anyone know why this is?
    Thanks in advanced.
     
  2. MalakasPlayzMCPE

    MalakasPlayzMCPE Zombie Pigman

    Messages:
    667
    Same here. Better use tiles...
     
  3. KielKing

    KielKing Zombie

    Messages:
    245
    GitHub:
    kielking
    Really? I don't want to use tiles as is it server-side, and not really efficient
     
  4. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    What exactly are you trying to do? If you are using packets for those things, then you'll need to handle ContainerClosePacket and InventoryTransactionPacket yourself. You may end up writing what's already written in the pocketmine core.
     
  5. MalakasPlayzMCPE

    MalakasPlayzMCPE Zombie Pigman

    Messages:
    667
  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.