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

Solved Delete Chest after spawned

Discussion in 'Development' started by xXNiceAssassinlo YT, Dec 10, 2017.

  1. xXNiceAssassinlo YT

    xXNiceAssassinlo YT Zombie Pigman

    Messages:
    499
    GitHub:
    xXNiceYT
    Delete chest when close.

    Code :
    PHP:
    public function sendInventory (Player $player) {
    $nbt = new CompoundTag "", [
    new 
    StringTag "id"Tile::CHEST ),
    new 
    IntTag "Inventory"),
    new 
    IntTag "x", ( int ) $player->getX () ),
    new 
    IntTag "y", ( int ) $player->getY () ),
    new 
    IntTag "z", ( int ) $player->getZ () )
    ] );
    /** @var Chest $tile */
    $tile Tile::createTile "Chest"$player->getLevel (), $nbt );
    $block Block::get Block::CHEST );
    $block->= ( int ) $tile->x;
    $block->= ( int ) $tile->y;
    $block->= ( int ) $tile->z;
    $block->level $tile->getLevel ();
    $block->level->sendBlocks ( [
    $player
    ], [
    $block
    ] );
    if (
    $tile instanceof Chest) {
    // Items
    $i $tile->getInventory();
    $i->addItem(Item::get(Item::STONE01));
    }
    $player->addWindow($tile->getInventory());
    }
     

    Attached Files:

  2. Karanpatel567

    Karanpatel567 Baby Zombie

    Messages:
    115
    GitHub:
    Karanpatel567
    I don't think you can remove that block, My tip is spawn that block about 5-4 blocks under the player. That would make it look a hidden
     
  3. xXNiceAssassinlo YT

    xXNiceAssassinlo YT Zombie Pigman

    Messages:
    499
    GitHub:
    xXNiceYT
    Ok thank you
     
  4. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    If you spawn it on top of player , he can't see it when inventory get open..
     
  5. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
  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.