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

Add name to a chest

Discussion in 'Development' started by DanielYTK, Apr 15, 2017.

  1. DanielYTK

    DanielYTK Zombie

    Messages:
    227
    I tried this:
    PHP:
    $block Block::get(Block::CHEST);
                            
    $sender->getLevel()->setBlock(new Vector3($sender->getX(), $sender->getY()-3$sender->getZ()), $blocktruetrue);
                            
    $nbt = new CompoundTag("", [
                            new 
    ListTag("Items", []),
                            new 
    StringTag("id"Tile::CHEST),
                            new 
    IntTag("x"$sender->getFloorX()),
                            new 
    IntTag("y"$sender->getFloorY() - 3),
                            new 
    IntTag("z"$sender->getFloorZ()),
                            ]);
                            
    $nbt->Items->setTagType(NBT::TAG_Compound);
                            
    $tile Tile::createTile("Chest"$sender->getLevel(), $nbt);
                            
    $tile->setName("§aCustomChest");
     
    but not work
     
  2. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    PHP:
    $block Block::get(Block::CHEST);
    $sender->getLevel()->setBlock($sender$blocktruetrue);
    $tile $sender->getLevel()->getTile($block);
    $tile->setName("§aCustomChest");
     
  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.