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

Solved How to spawn lying human?

Discussion in 'Development' started by GamakCZ, Aug 17, 2017.

  1. GamakCZ

    GamakCZ Zombie Pigman

    Messages:
    598
    GitHub:
    GamakCZ
    I'm creating a MurderMystery plugin, but there's a little trouble I do not know how to fix. When I use this code, Human is seen only in the spectator mode.

    PHP:
    $nbt = new CompoundTag("", [
            
    "Pos" => new ListTag("Pos", [
                new 
    DoubleTag(""$entity->getX()),
                new 
    DoubleTag(""$entity->getY()+1),
                new 
    DoubleTag(""$entity->getZ())
            ]),
            
    "Motion" => new ListTag("Motion", [
                new 
    DoubleTag(""0),
                new 
    DoubleTag(""0),
                new 
    DoubleTag(""0)
            ]),
            
    "Rotation" => new ListTag("Rotation", [
                new 
    FloatTag(""$entity->getPitch()),
                new 
    FloatTag(""$entity->getYaw())
            ]),
            
    "Skin" => new CompoundTag("Skin", [
                
    "Data" => new StringTag("Data"$entity->getSkinData()),
                
    "Name" => new StringTag("Name"$entity->getSkinId())
            ])
        ]
    );

    $npc = new Human($entity->getLevel(), $nbt);
    $npc->setDataFlag(Human::DATA_PLAYER_FLAGSHuman::DATA_PLAYER_FLAG_SLEEPtrueHuman::DATA_TYPE_BYTE);
    $npc->setNameTag("§c".$entity->getName());
    $npc->spawnTo($entity);
     
  2. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    What is $entity ?
     
  3. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    Human
     
    Levi likes this.
  4. TheNewHEROBRINE

    TheNewHEROBRINE Spider

    Messages:
    8
    GitHub:
    thenewherobrinex
  5. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    $entity is your damaged entity in entitydamageevent and you moving then to spectate mode after damaging that why this happens :D
     
  6. GamakCZ

    GamakCZ Zombie Pigman

    Messages:
    598
    GitHub:
    GamakCZ
    thx
     
  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.