Open crafting table with command

Discussion in 'General discussion' started by MusicNOvas, May 7, 2019.

  1. MusicNOvas

    MusicNOvas Spider Jockey

    Messages:
    43
    How can i open the crafting table with a command ?
    Code:
    [Server thread/CRITICAL]: Error: "Call to undefined method pocketmine\Player::getTile()" (EXCEPTION)
    PHP:
    public function onCommand(CommandSender $senderCommand $cmdstring $label, array $args) : bool{
       
            switch(
    $cmd->getName()){
             
                case 
    "craft":
                if(
    $sender instanceof Player){
                    
    $sender->getTile(new Vector3(10060100))->getInventory();
                }
            }
        }
     
    Last edited: May 7, 2019
  2. wolfdale

    wolfdale Zombie

    Messages:
    327
    You cant do that, it is client side
     
    Sandertv likes this.
  3. GamakCZ

    GamakCZ Zombie

    Messages:
    225
    GitHub:
    GamakCZ
    Probably it isn't possible but you can try it.

    1) Add the Player->getLevel() because Player->getTile doesn't work
    PHP:
    $sender->getLevel()->getTile(new Vector3(10060100))->getInventory();
    2) Add crafting table closer to the player
     
  4. MusicNOvas

    MusicNOvas Spider Jockey

    Messages:
    43
    Thanks ! But I have a some problem.
    Code:
    Call to a member function getInventory() on null
     
  5. GamakCZ

    GamakCZ Zombie

    Messages:
    225
    GitHub:
    GamakCZ
    That's because of on pos 100 60 100 isn't loaded tile
     
  6. jasonwynn10

    jasonwynn10 Wither Skeleton Poggit Reviewer

    Messages:
    1,382
    GitHub:
    jasonwynn10
    Crafting tables don't have tiles...
     
    GamakCZ and Levi like this.
  7. Levi

    Levi Skeleton

    Messages:
    846
    GitHub:
    captainleviftw
    Look at tiles first lol
     

Share This Page

  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.