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

DATA_FLAG_SNEAKING?

Discussion in 'Development' started by PaulchenHD, Jun 3, 2017.

  1. PaulchenHD

    PaulchenHD Creeper

    Messages:
    1
    I like to set a npc sneaking with DATA_FLAG_SNEAKING but I don't know how to do this.

    PHP:
                $pk = new AddPlayerPacket();
                
    $pk->eid Entity::$entityCount++;
                
    $pk->uuid UUID::fromRandom();
                
    $pk->username "Test";
                
    $pk->yaw rand(0360);
                
    $pk->item Item::get(0);
                
    $pk->pitch rand(090);
                
    $pk->$player->x;
                
    $pk->$player->y;
                
    $pk->$player->z;
                
    $pk->metadata = [
                    
    Entity::DATA_FLAGS => [Entity::DATA_TYPE_BYTE<< Entity::DATA_FLAG_INVISIBLE],
                    
    Entity::DATA_NAMETAG => [Entity::DATA_TYPE_STRING"Test"],
                    
    Entity::DATA_SHOW_NAMETAG => [Entity::DATA_TYPE_BYTE1],
                    
    Entity::DATA_LEAD_HOLDER => [Entity::DATA_TYPE_LONG, -1],
                    
    Entity::DATA_FLAG_SNEAKING => // ?
                
    ];
    $player->dataPacket($pk);
     
    Last edited: Jun 3, 2017
  2. moska

    moska Baby Zombie

    Messages:
    105
    GitHub:
    supermaxalex
    Please use [ PHP ] and [ /PHP ] for PHP codes

    PHP:
    $pk = new AddPlayerPacket();
    $pk->entityRuntimeId Entity::$entityCount++; //"eid" has been replaced, it's "entityRuntimeId"
    $pk->uuid UUID::fromRandom();
    //$pk->username = "Test"; //This is totally useless
    $pk->yaw rand(0360); //What do you want to do ? rand() is no adapted there
    $pk->item Item::get(0);
    $pk->pitch rand(090); //What do you want to do ? rand() is no adapted there
    $pk->$player->x;
    $pk->$player->y;
    $pk->$player->z;
    $pk->metadata = [
           
    Entity::DATA_FLAGS => [Entity::DATA_TYPE_BYTE<< Entity::DATA_FLAG_INVISIBLE],
           
    Entity::DATA_NAMETAG => [Entity::DATA_TYPE_STRING"Test"],
           
    Entity::DATA_SHOW_NAMETAG => [Entity::DATA_TYPE_BYTE1],
           
    Entity::DATA_LEAD_HOLDER_EID => [Entity::DATA_TYPE_LONG, -1], //It's DATA_LEAD_HOLDER_EID and not DATA_LEAD_HOLDER. Don't report something there if you are using a spoon, spoons have different problems and codes.
           
    Entity::DATA_FLAG_SNEAKING => [Entity::DATA_TYPE_BYTE1]
    ];
    $player->dataPacket($pk);
     
  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.