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

Inventory do not send to player.

Discussion in 'Development' started by nerzox, Aug 5, 2020.

  1. nerzox

    nerzox Spider

    Messages:
    7
    GitHub:
    Nerzoxxx-dev
    Hello all, I have a preblem. My inventory do not send to player when I use this:

    $player->addWindow($chest->getInventory);

    Can you help me ? Code of my inventory : https://pastebin.com/gz9tfjjR

    Thanks for your help.
     
  2. newcoolboys

    newcoolboys Spider

    Messages:
    12
    GitHub:
    Newcoolboys
    Try this, on your open add $this->sendContents($who);
     
  3. newcoolboys

    newcoolboys Spider

    Messages:
    12
    GitHub:
    Newcoolboys
    Code:
        public function onOpen(Player $who) : void{
            parent::onOpen($who);
    
            if(count($this->getViewers()) === 1 and $this->getHolder()->isValid()){
                $this->broadcastBlockEventPacket(true);
                $this->getHolder()->getLevelNonNull()->broadcastLevelSoundEvent($this->getHolder()->add(0.5, 0.5, 0.5), $this->getOpenSound());
            }
            $this->sendContents($who);
        }
     
  4. nerzox

    nerzox Spider

    Messages:
    7
    GitHub:
    Nerzoxxx-dev
    It still does not work.
     
  5. nerzox

    nerzox Spider

    Messages:
    7
    GitHub:
    Nerzoxxx-dev
    Code:
    public function onOpen(Player $who) : void{
            parent::onOpen($who);
            $this->sendContents($who);
            if(count($this->getViewers()) === 1 and $this->getHolder()->isValid()){
                $this->broadcastBlockEventPacket(true);
                $this->getHolder()->getLevelNonNull()->broadcastLevelSoundEvent($this->getHolder()->add(0.5, 0.5, 0.5), $this->getOpenSound());
            }
        }
     
  6. nerzox

    nerzox Spider

    Messages:
    7
    GitHub:
    Nerzoxxx-dev
    I have look your edit but it doesn't change anything.
     
  7. nerzox

    nerzox Spider

    Messages:
    7
    GitHub:
    Nerzoxxx-dev
    Code when i send inventory :
    Code:
    public function onActivate(Item $item, Player $player = null): bool
    {
        if($player instanceof Player){
    
            $t = $this->getLevelNonNull()->getTile($this);
            $chest = null;
            if($t instanceof DrawerTile){
                $chest = $t;
            }else{
                $chest = Tile::createTile(Tile::DRAWER, $this->getLevelNonNull(), DrawerTile::createNBT($this));
                if(!($chest instanceof DrawerTile)){
                    return true;
                }
            }
            $player->addWindow($chest->getInventory());
        }
    
        return true;
    }
     
  8. Emirhan Akpınar

    Emirhan Akpınar Slime

    Messages:
    90
    You must create fake tile and send fake chest block.
     
  9. GodWeedZao

    GodWeedZao Zombie Pigman

    Messages:
    401
    GitHub:
    godweedzao
    use @mqusit 's fake inv ;)
     
  10. nerzox

    nerzox Spider

    Messages:
    7
    GitHub:
    Nerzoxxx-dev
    that is to say?
     
  11. nerzox

    nerzox Spider

    Messages:
    7
    GitHub:
    Nerzoxxx-dev
    I want create my tile.
     
  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.