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

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 Pigman

    Messages:
    535
    GitHub:
    diamond-gold
    You cant do that, it is client side
     
    Sandertv likes this.
  3. GamakCZ

    GamakCZ Zombie Pigman

    Messages:
    598
    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 Pigman

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

    jasonwynn10 Moderator Poggit Reviewer

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

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    Look at tiles first lol
     
  8. Ole

    Ole Creeper

    Messages:
    3
    Whats right
     
  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.