ref #106 on online-bot example
This commit is contained in:
@ -48,12 +48,16 @@ func ExampleClient_JoinServer_offline() {
|
|||||||
func ExampleClient_JoinServer_online() {
|
func ExampleClient_JoinServer_online() {
|
||||||
c := NewClient()
|
c := NewClient()
|
||||||
|
|
||||||
//Login Mojang account to get AccessToken
|
// Login Mojang account to get AccessToken
|
||||||
|
// To use Microsoft Account, see issue #106
|
||||||
|
// https://github.com/Tnze/go-mc/issues/106
|
||||||
auth, err := yggdrasil.Authenticate("Your E-mail", "Your Password")
|
auth, err := yggdrasil.Authenticate("Your E-mail", "Your Password")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// As long as you set these three fields correctly,
|
||||||
|
// the client can connect to the online-mode server
|
||||||
c.Auth.UUID, c.Auth.Name = auth.SelectedProfile()
|
c.Auth.UUID, c.Auth.Name = auth.SelectedProfile()
|
||||||
c.Auth.AsTk = auth.AccessToken()
|
c.Auth.AsTk = auth.AccessToken()
|
||||||
|
|
||||||
|
@ -5,8 +5,6 @@ package main
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"flag"
|
"flag"
|
||||||
"github.com/Tnze/go-mc/bot/world"
|
|
||||||
"github.com/Tnze/go-mc/level"
|
|
||||||
"log"
|
"log"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -16,9 +14,11 @@ import (
|
|||||||
"github.com/Tnze/go-mc/bot"
|
"github.com/Tnze/go-mc/bot"
|
||||||
"github.com/Tnze/go-mc/bot/basic"
|
"github.com/Tnze/go-mc/bot/basic"
|
||||||
"github.com/Tnze/go-mc/bot/screen"
|
"github.com/Tnze/go-mc/bot/screen"
|
||||||
|
"github.com/Tnze/go-mc/bot/world"
|
||||||
"github.com/Tnze/go-mc/chat"
|
"github.com/Tnze/go-mc/chat"
|
||||||
"github.com/Tnze/go-mc/data/item"
|
"github.com/Tnze/go-mc/data/item"
|
||||||
_ "github.com/Tnze/go-mc/data/lang/zh-cn"
|
_ "github.com/Tnze/go-mc/data/lang/zh-cn"
|
||||||
|
"github.com/Tnze/go-mc/level"
|
||||||
)
|
)
|
||||||
|
|
||||||
var address = flag.String("address", "127.0.0.1", "The server address")
|
var address = flag.String("address", "127.0.0.1", "The server address")
|
||||||
|
Reference in New Issue
Block a user