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

"CustomNameVisible": Expected a tag of type ByteTag, got StringTag

Discussion in 'Development' started by instantlyta, Dec 23, 2017.

  1. instantlyta

    instantlyta Slime

    Messages:
    96
    GitHub:
    intagaming
    Assume this is my fault when making a plugin, not the owner of Slapper's fault.
    Trying to upgrade from very old-y server and got this error from Slapper entities when constructing:
    Code:
    [Server thread/CRITICAL]: RuntimeException: "Expected a tag of type pocketmine\nbt\tag\ByteTag, got pocketmine\nbt\tag\StringTag" (EXCEPTION) in "src/pocketmine/nbt/tag/CompoundTag" at line 99
    [Server thread/DEBUG]: #0 src/pocketmine/nbt/tag/CompoundTag(175): pocketmine\nbt\tag\CompoundTag->getTag(string CustomNameVisible, string pocketmine\nbt\tag\ByteTag)
    [Server thread/DEBUG]: #1 src/pocketmine/nbt/tag/CompoundTag(199): pocketmine\nbt\tag\CompoundTag->getTagValue(string CustomNameVisible, string pocketmine\nbt\tag\ByteTag, integer 1, boolean )
    [Server thread/DEBUG]: #2 src/pocketmine/entity/Entity(834): pocketmine\nbt\tag\CompoundTag->getByte(string CustomNameVisible, integer 1)
    [Server thread/DEBUG]: #3 src/pocketmine/entity/Living(71): pocketmine\entity\Entity->initEntity()
    [Server thread/DEBUG]: #4 src/pocketmine/entity/Entity(539): pocketmine\entity\Living->initEntity()
    [Server thread/DEBUG]: #5 src/pocketmine/entity/Entity(256): pocketmine\entity\Entity->__construct(pocketmine\level\Level object, pocketmine\nbt\tag\CompoundTag object)
    [Server thread/DEBUG]: #6 src/pocketmine/level/format/Chunk(746): pocketmine\entity\Entity::createEntity(string Zombie, pocketmine\level\Level object, pocketmine\nbt\tag\CompoundTag object)
    [Server thread/DEBUG]: #7 src/pocketmine/level/Level(2690): pocketmine\level\format\Chunk->initChunk(pocketmine\level\Level object)
    [Server thread/DEBUG]: #8 src/pocketmine/level/Level(2335): pocketmine\level\Level->loadChunk(integer -1, integer 0, boolean 1)
    [Server thread/DEBUG]: #9 src/pocketmine/level/Level(2958): pocketmine\level\Level->getChunk(integer -1, integer 0, boolean 1)
    [Server thread/DEBUG]: #10 src/pocketmine/Player(969): pocketmine\level\Level->populateChunk(integer -1, integer 0)
    [Server thread/DEBUG]: #11 src/pocketmine/Player(1743): pocketmine\Player->sendNextChunk()
    [Server thread/DEBUG]: #12 src/pocketmine/Server(2537): pocketmine\Player->checkNetwork()
    [Server thread/DEBUG]: #13 src/pocketmine/Server(2274): pocketmine\Server->tick()
    [Server thread/DEBUG]: #14 src/pocketmine/Server(2149): pocketmine\Server->tickProcessor()
    [Server thread/DEBUG]: #15 src/pocketmine/Server(1737): pocketmine\Server->start()
    [Server thread/DEBUG]: #16 src/pocketmine/PocketMine(554): pocketmine\Server->__construct(BaseClassLoader object, pocketmine\utils\MainLogger object, string D:\Files\MCPE\PocketMine-MP\, string D:\Files\MCPE\PocketMine-MP\plugins\)
    
    There is some incompatible going on. I tried this but didn't work:


    PHP:
    class SlapperHuman extends Human
    {

        public function 
    __construct(Level $levelCompoundTag $nbt)
        {
            if(!(
    $nbt->getTag("CustomNameVisible") instanceof ByteTag)) {
                
    $nbt->setByte("CustomNameVisible"1true);
            }
            
    parent::__construct($level$nbt);
            ...
    }
    How can I properly rewrite the nbt of the entity?
     
  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.