Player NPCs - no head layer

Discussion in 'Spigot Plugin Development' started by Rixterz, Jun 11, 2016.

  1. Hi

    I'm spawning player NPCs using the following code, but the outer head layer doesn't show

    Code (Text):

    UUID uuid = UUID.fromString("ee5a3807-d049-4845-9d59-25ac12904d29");
         String name = "Rix";
       
         MinecraftServer nmsServer = ((CraftServer) Bukkit.getServer()).getServer();
      WorldServer nmsWorld = ((CraftWorld) Bukkit.getWorlds().get(0)).getHandle();
      npc = new EntityPlayer(nmsServer, nmsWorld, new GameProfile(uuid, name), new PlayerInteractManager(nmsWorld));
       
         for(Player p : s.getOnlinePlayers())
         {
           npc.setLocation(p.getLocation().getX(), p.getLocation().getY(), p.getLocation().getZ(), 0, 0);
        PlayerConnection connection = ((CraftPlayer) p).getHandle().playerConnection;
        connection.sendPacket(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, npc));
        connection.sendPacket(new PacketPlayOutNamedEntitySpawn(npc));
         }


     
     
    #1 Rixterz, Jun 11, 2016
    Last edited: Jun 11, 2016