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

I need help adapting new nbt

Discussion in 'Development' started by WhoAreMe, May 12, 2020.

  1. WhoAreMe

    WhoAreMe Witch

    Messages:
    55
    I read this thread https://forums.pmmp.io/threads/adapting-old-code-using-compoundtags-since-api-3-0-0-alpha12.5975/ that adapt old code to new code but i need help.

    In his example he shows how to replace the old child tag compound to new.
    Like this
    unset($nbt->SomeTag);
    should be replaced with
    $nbt->removeTag("SomeTag");

    But what if this one has more object or function?
    unset($nbt->SomeTag); //
    unset($nbt->SomeTag->hasMoreObject); //idk what shall i call this. Is this calling object to another object? Im a nub lol.
    Shall i remove it with the last object like this?
    $nbt->removeTag("hasMoreObject");

    I need help lol
     
  2. mlsdmitry0

    mlsdmitry0 Spider

    Messages:
    12
    If you unset($nbt->sometag) then $nbt->sometag will deleted fully. You just need to delete the root of tag.
     
  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.