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

Chest Tile Not Work

Discussion in 'Development' started by HeyDeniis_, Jun 24, 2019.

  1. HeyDeniis_

    HeyDeniis_ Baby Zombie

    Messages:
    137
    Where have error ?
    PHP:
    $level->setBlock(new Vector3(01010), new Block(540));
            
    $nbt = new CompoundTag(" ", [
                new 
    ListTag("Items", []),
                new 
    StringTag("id"Tile::CHEST),
                new 
    IntTag("x"0),
                new 
    IntTag("y"101),
                new 
    IntTag("z"0)
            ]);
            
    $nbt->Items->setTagType(NBT::TAG_Compound);
            
    $chest Tile::createTile("Chest"$level$nbt);
            
    $level->addTile($chest);
            
    $inv $chest->getInventory();
            
    $inv->addItem(Item::get(7901));
            
    $inv->addItem(Item::get(325101));
            
    $inv->addItem(Item::get(10301));
            
    $inv->addItem(Item::get(8601));
            
    $inv->addItem(Item::get(297032));
            
    $inv->addItem(Item::get(30101));
            
    $inv->addItem(Item::get(35208));
            
    $inv->addItem(Item::get(5003));
            
    $inv->addItem(Item::get(28501));
            
    $inv->addItem(Item::get(601));

    Error Console:

    23.06 19:14:00 [ServerServer thread/CRITICAL RuntimeException"Cannot access dynamic field "Items": Dynamic field access on pocketmine\nbt\tag\CompoundTag is no longer supported" (EXCEPTIONin "vendor/pocketmine/nbt/src/tag/NoDynamicFieldsTrait" at line 31
    23.06 19
    :14:00 [ServerServer thread/DEBUG #0 vendor/pocketmine/nbt/src/tag/NoDynamicFieldsTrait(35): pocketmine\nbt\tag\CompoundTag->throw(string Items)
    sorry for My English is bad and error "Useless"
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    You copied NBT code from an old pocketmine plugin or source code. Copy it from a new one instead.

    https://github.com/pmmp/PocketMine-...845819acb/src/pocketmine/block/Chest.php#L111
     
  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.