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

Type Error on setCompoundTag

Discussion in 'General discussion' started by Hoangviphb999, Jan 13, 2022.

  1. Hoangviphb999

    Hoangviphb999 Silverfish

    Messages:
    21
    GitHub:
    Hoangviphb999
    Hi, im getting error on making firework and i have fixed something but it cause this error when using PM4.0.5 due to BedrockProtocol change on EntitiyMetadataCollection, here my code construction :
    public function syncNetworkData(EntityMetadataCollection $properties): void
    {
    parent::syncNetworkData($properties);
    $properties->setCompoundTag(self::DATA_FIREWORK_ITEM, $this->fireworks->root);
    }

    The latest BedrockProtocol contruct so i don't know how to fix this:
    public function setCompoundTag(int $key, CacheableNbt $value, bool $force = false) : void{
    $this->set($key, new CompoundTagMetadataProperty($value), $force);
    }

    Thanks!
     
  2. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Give us the error please.
     
  3. Hoangviphb999

    Hoangviphb999 Silverfish

    Messages:
    21
    GitHub:
    Hoangviphb999
    pocketmine\network\mcpe\protocol\types\entity\EntityMetadataCollection::setCompoundTag(): Argument #2 ($value) must be of type pocketmine\network\mcpe\protocol\types\CacheableNbt, string given, called in C:\Users\Administrator\Desktop\API\plugins\Firework Fixed\src\RolandDev\BedWars\libs\BlockHorizons\Fireworks\entity\FireworksRocket.php on line 120
     
  4. Hoangviphb999

    Hoangviphb999 Silverfish

    Messages:
    21
    GitHub:
    Hoangviphb999
    The error code is on $properties->setCompoundTag
     
  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.