How to put item into Chest?

Discussion in 'Development' started by JinKaidoMC, Feb 12, 2019.

Thread Status:
Not open for further replies.
  1. JinKaidoMC

    JinKaidoMC Spider

    Messages:
    13
    GitHub:
    kaidoMC
    I used this code
    $level = $sender->getLevel();
    $x = $sender->getX();
    $y = $sender->getY();
    $z = $sender->getZ();
    $level->setBlock(new Vector3($x, $y, $z), Block::CHEST);
    $chest = $sender->getPlayer()->getLevel()->getTile(new Vector3($x, $y, $z));
    if($chest instanceof Chest){
    $chest->getInventory()->setItem(Item::get(278, 0, 1));
     
  2. JinKaidoMC

    JinKaidoMC Spider

    Messages:
    13
    GitHub:
    kaidoMC
    It's great when you help me!
     
  3. KielKing

    KielKing Zombie

    Messages:
    213
    GitHub:
    kielking
    PHP:
    $level $sender->getLevel();
    $chestPos $sender->add(02);

    $level->setBlock($chestPosBlock::CHEST);

    /** use pocketmine\tile\Chest; */
    $chestNBT Chest::createNBT($chestPos);
    $chestTile Tile::createTile(Tile::CHEST$level$chestNBT);

    if(
    $chestTile instanceof Chest){
        
    $chestTile->getInventory()->setItem(0Item::get(27801));
    }
     
  4. JinKaidoMC

    JinKaidoMC Spider

    Messages:
    13
    GitHub:
    kaidoMC
    Thanks ! If there is an error please help me again.
     
  5. KielKing

    KielKing Zombie

    Messages:
    213
    GitHub:
    kielking
    sounds kinda entitled don't you think
     
    SavionLegendZzz and Muqsit like this.
  6. JinKaidoMC

    JinKaidoMC Spider

    Messages:
    13
    GitHub:
    kaidoMC
    I encountered this error! This is the output :
    [Server] [01:59:15] [Server thread/CRITICAL]: Unhandled exception executing command 'sb claim' in skyblock: Argument 2 passed to pocketmine\level\Level::setBlock() must be an instance of pocketmine\block\Block, integer given, called in /storage/emulated/0/PocketMine/plugins/SB/src/MyPlot/subcommand/ClaimSubCommand.php on line 68
    [Server] [01:59:15] [Server thread/CRITICAL]: TypeError: "Argument 2 passed to pocketmine\level\Level::setBlock() must be an instance of pocketmine\block\Block, integer given, called in /storage/emulated/0/PocketMine/plugins/SB/src/MyPlot/subcommand/ClaimSubCommand.php on line 68" (EXCEPTION) in "/src/pocketmine/level/Level" at line 1493
     
  7. wolfdale

    wolfdale Zombie

    Messages:
    258
    Change
    PHP:
    $level->setBlock($chestPosBlock::CHEST);
    To
    PHP:
    $level->setBlock($chestPosBlock::get(Block::CHEST));
     
  8. Kkora

    Kkora Baby Zombie

    Messages:
    167
    GitHub:
    kkora2k3
    That the price haha!
    He is using Genisys for MCPE 0.14.3-Alpha so it's different from us (maybe) so it may cause some problem for coding from the latest to the almost oldest version
     
  9. KielKing

    KielKing Zombie

    Messages:
    213
    GitHub:
    kielking
    how do you know he's using genisys?
     
  10. Kkora

    Kkora Baby Zombie

    Messages:
    167
    GitHub:
    kkora2k3
    I know him alot
     
  11. KielKing

    KielKing Zombie

    Messages:
    213
    GitHub:
    kielking
    alright
     
    Kkora likes this.
  12. JinKaidoMC

    JinKaidoMC Spider

    Messages:
    13
    GitHub:
    kaidoMC
    He knows abusing my staff to destroy my server.
     
  13. JinKaidoMC

    JinKaidoMC Spider

    Messages:
    13
    GitHub:
    kaidoMC
    This is the last time. Don't go to my site to comment
     
  14. KielKing

    KielKing Zombie

    Messages:
    213
    GitHub:
    kielking
    please don't flood the thread with off-topic posts and keep drama in DMs
     
  15. JinKaidoMC

    JinKaidoMC Spider

    Messages:
    13
    GitHub:
    kaidoMC
    Ok bros
     
  16. Kkora

    Kkora Baby Zombie

    Messages:
    167
    GitHub:
    kkora2k3
    is this your site?
    lag: 9999+ ms
     
  17. JinKaidoMC

    JinKaidoMC Spider

    Messages:
    13
    GitHub:
    kaidoMC
    Oh. But please don't comment into my wall
     
Thread Status:
Not open for further replies.

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.