update protocol packet definitions: replace value receivers with pointer receivers in PacketID methods, expand FixedBitSet size from 8 to 256 bits, and remove outdated documentation files
This commit is contained in:
37
cmd/template/main.go
Normal file
37
cmd/template/main.go
Normal file
@ -0,0 +1,37 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"git.konjactw.dev/patyhank/minego/pkg/auth"
|
||||
"git.konjactw.dev/patyhank/minego/pkg/bot"
|
||||
"git.konjactw.dev/patyhank/minego/pkg/client"
|
||||
"git.konjactw.dev/patyhank/minego/pkg/game/player"
|
||||
)
|
||||
|
||||
func main() {
|
||||
userCode := "powru"
|
||||
c := client.NewClient(&bot.ClientOptions{AuthProvider: &auth.KonjacAuth{
|
||||
UserCode: userCode,
|
||||
}})
|
||||
|
||||
ctx, cancelFunc := context.WithCancel(context.Background())
|
||||
defer cancelFunc()
|
||||
|
||||
err := c.Connect(ctx, "mc.konjactw.dev", nil)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
bot.SubscribeEvent(c, func(e player.MessageEvent) error {
|
||||
fmt.Println(e.Message.String())
|
||||
return nil
|
||||
})
|
||||
|
||||
err = c.HandleGame(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
The recommended login sequence as of 1.21 looks like this, where C is the client and S is the server:
|
||||
|
||||
Client connects to the server
|
||||
C→S: Handshake State=2
|
||||
C→S: Login Start
|
||||
S→C: Encryption Request (optional)
|
||||
Client auth (Only if server sent Encryption Request)
|
||||
C→S: Encryption Response (Only if server sent Encryption Request)
|
||||
Server auth, both enable encryption (Only if server sent Encryption Request)
|
||||
S → C: Set Compression (Optional, enables compression)
|
||||
S → C: Login Success
|
||||
C → S: Login Acknowledged
|
||||
C → S: Serverbound Plugin Message (Optional, minecraft:brand with the client's brand)
|
||||
C → S: Client Information (Optional)
|
||||
S → C: Clientbound Plugin Message (Optional, minecraft:brand with the server's brand)
|
||||
S → C: Feature Flags (Optional)
|
||||
S → C: Clientbound Known Packs
|
||||
C → S: Serverbound Known Packs
|
||||
S → C: Registry Data (Multiple)
|
||||
S → C: Update Tags (Optional)
|
||||
S → C: Finish Configuration
|
||||
C → S: Acknowledge Finish Configuration
|
||||
S → C: Login (play)
|
||||
S → C: Change Difficulty (Optional)
|
||||
S → C: Player Abilities (Optional)
|
||||
S → C: Set Held Item (Optional)
|
||||
S → C: Update Recipes (Optional)
|
||||
S → C: Entity Event (Optional, for the OP permission level; see Entity statuses#Player)
|
||||
S → C: Commands (Optional)
|
||||
S → C: Update Recipe Book (Optional)
|
||||
S → C: Synchronize Player Position
|
||||
C → S: Confirm Teleportation
|
||||
C → S: Set Player Position and Rotation (Optional, to confirm the spawn position)
|
||||
S → C: Server Data (Optional)
|
||||
S → C: Player Info Update (Add Player action, all players except the one joining (the vanilla server separates these, you don't need to))
|
||||
S → C: Player Info Update (Add Player action, joining player)
|
||||
S → C: Initialize World Border (Optional)
|
||||
S → C: Update Time (Optional)
|
||||
S → C: Set Default Spawn Position (Optional, “home” spawn, not where the client will spawn on login)
|
||||
S → C: Game Event (Start waiting for level chunks event, required for the client to spawn)
|
||||
S → C: Set Ticking State (Optional)
|
||||
S → C: Step Tick (Optional, the vanilla server sends this regardless of ticking state)
|
||||
S → C: Set Center Chunk
|
||||
S → C: Chunk Data and Update Light (One sent for each chunk in a circular area centered on the player's position)
|
||||
S → C: inventory, entities, etc.
|
@ -308,9 +308,32 @@ func (o *OfflineAuth) Authenticate(ctx context.Context, conn *net.Conn, content
|
||||
}
|
||||
|
||||
type KonjacAuth struct {
|
||||
*OnlineAuth
|
||||
UserCode string
|
||||
Profile Profile
|
||||
}
|
||||
|
||||
func (k *KonjacAuth) Authenticate(ctx context.Context, conn *net.Conn, content client.LoginHello) error {
|
||||
key, encodeStream, decodeStream := newSymmetricEncryption()
|
||||
|
||||
err := k.LoginAuth(ctx, content, key)
|
||||
if err != nil {
|
||||
return errors.Join(ErrEncrypt, fmt.Errorf("login auth fail: %w", err))
|
||||
}
|
||||
|
||||
// Response with Encryption Key
|
||||
var pkt pk.Packet
|
||||
pkt, err = genEncryptionKeyResponse(key, content.PublicKey, content.VerifyToken)
|
||||
if err != nil {
|
||||
return fmt.Errorf("gen encryption key response fail: %v", err)
|
||||
}
|
||||
|
||||
err = conn.WritePacket(pkt)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Set Connection Encryption
|
||||
conn.SetCipher(encodeStream, decodeStream)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (k *KonjacAuth) LoginAuth(ctx context.Context, content client.LoginHello, key []byte) error {
|
||||
@ -322,7 +345,7 @@ func (k *KonjacAuth) LoginAuth(ctx context.Context, content client.LoginHello, k
|
||||
ServerID string `json:"serverId"`
|
||||
}{
|
||||
AccessToken: k.UserCode,
|
||||
SelectedProfile: "",
|
||||
SelectedProfile: "-",
|
||||
ServerID: digest,
|
||||
})
|
||||
|
||||
@ -372,10 +395,19 @@ func (k *KonjacAuth) FetchProfile(ctx context.Context) *Profile {
|
||||
return nil
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
_, _ = io.ReadAll(resp.Body)
|
||||
if resp.StatusCode != http.StatusNoContent {
|
||||
data, err = io.ReadAll(resp.Body)
|
||||
if resp.StatusCode >= 300 {
|
||||
return nil
|
||||
}
|
||||
|
||||
return nil
|
||||
var profile struct {
|
||||
SelectedProfile Profile `json:"selectedProfile"`
|
||||
}
|
||||
|
||||
err = json.Unmarshal(data, &profile)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return &profile.SelectedProfile
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import (
|
||||
|
||||
type Client interface {
|
||||
Connect(ctx context.Context, addr string, options *ConnectOptions) error
|
||||
HandleGame(ctx context.Context) error
|
||||
Close(ctx context.Context) error
|
||||
IsConnected() bool
|
||||
WritePacket(ctx context.Context, packet server.ServerboundPacket) error
|
||||
|
@ -13,8 +13,9 @@ func PublishEvent(client Client, event Event) error {
|
||||
return client.EventHandler().PublishEvent(event.EventID(), event)
|
||||
}
|
||||
|
||||
func SubscribeEvent(client Client, event string, handler func(event Event) error) {
|
||||
client.EventHandler().SubscribeEvent(event, func(data any) error {
|
||||
return handler(data.(Event))
|
||||
func SubscribeEvent[T Event](client Client, handler func(event T) error) {
|
||||
var t T
|
||||
client.EventHandler().SubscribeEvent(t.EventID(), func(data any) error {
|
||||
return handler(data.(T))
|
||||
})
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ func (b *botClient) Connect(ctx context.Context, addr string, options *bot.Conne
|
||||
|
||||
// 建立連接
|
||||
dialer := &mcnet.DefaultDialer
|
||||
conn, err := dialer.DialMCContext(ctx, addr)
|
||||
b.conn, err = dialer.DialMCContext(ctx, addr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -104,7 +104,7 @@ func (b *botClient) Connect(ctx context.Context, addr string, options *bot.Conne
|
||||
host = options.FakeHost
|
||||
}
|
||||
|
||||
err = b.handshake(conn, host, port)
|
||||
err = b.handshake(host, port)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -119,17 +119,18 @@ func (b *botClient) Connect(ctx context.Context, addr string, options *bot.Conne
|
||||
return err
|
||||
}
|
||||
|
||||
b.conn = conn
|
||||
b.connected = true
|
||||
|
||||
// 啟動封包處理 goroutine
|
||||
go b.handlePackets(ctx)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *botClient) handshake(conn *mcnet.Conn, host string, port uint64) error {
|
||||
return conn.WritePacket(pk.Marshal(
|
||||
func (b *botClient) HandleGame(ctx context.Context) error {
|
||||
return b.handlePackets(ctx)
|
||||
}
|
||||
|
||||
func (b *botClient) handshake(host string, port uint64) error {
|
||||
return b.conn.WritePacket(pk.Marshal(
|
||||
0,
|
||||
pk.VarInt(772),
|
||||
pk.String(host),
|
||||
@ -138,21 +139,28 @@ func (b *botClient) handshake(conn *mcnet.Conn, host string, port uint64) error
|
||||
))
|
||||
}
|
||||
|
||||
func (b *botClient) handlePackets(ctx context.Context) {
|
||||
func (b *botClient) handlePackets(ctx context.Context) error {
|
||||
group, ctx := errgroup.WithContext(ctx)
|
||||
group.SetLimit(15)
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
return ctx.Err()
|
||||
default:
|
||||
var p pk.Packet
|
||||
if err := b.conn.ReadPacket(&p); err != nil {
|
||||
return
|
||||
return err
|
||||
}
|
||||
|
||||
creator, ok := client.ClientboundPackets[packetid.ClientboundPacketID(p.ID)]
|
||||
pktID := packetid.ClientboundPacketID(p.ID)
|
||||
if pktID == packetid.ClientboundStartConfiguration {
|
||||
err := b.configuration()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
continue
|
||||
}
|
||||
creator, ok := client.ClientboundPackets[pktID]
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
@ -172,6 +180,7 @@ func (b *botClient) handlePackets(ctx context.Context) {
|
||||
func NewClient(options *bot.ClientOptions) bot.Client {
|
||||
c := &botClient{
|
||||
packetHandler: newPacketHandler(),
|
||||
eventHandler: NewEventHandler(),
|
||||
authProvider: options.AuthProvider,
|
||||
}
|
||||
|
||||
@ -180,7 +189,6 @@ func NewClient(options *bot.ClientOptions) bot.Client {
|
||||
}
|
||||
|
||||
c.world = world.NewWorld(c)
|
||||
c.eventHandler = NewEventHandler()
|
||||
c.inventory = inventory.NewManager(c)
|
||||
c.player = player.New(c)
|
||||
|
||||
|
@ -35,6 +35,14 @@ func New(c bot.Client) *Player {
|
||||
pl.lastReceivedPacketTime = time.Now()
|
||||
})
|
||||
|
||||
bot.AddHandler(c, func(ctx context.Context, p *client.KeepAlive) {
|
||||
c.WritePacket(ctx, &server.KeepAlive{
|
||||
ID: p.ID,
|
||||
})
|
||||
})
|
||||
bot.AddHandler(c, func(ctx context.Context, p *client.Disconnect) {
|
||||
fmt.Println(p.Reason.String())
|
||||
})
|
||||
bot.AddHandler(c, func(ctx context.Context, p *client.SystemChatMessage) {
|
||||
if !p.Overlay {
|
||||
bot.PublishEvent(c, MessageEvent{Message: p.Content})
|
||||
|
@ -22,8 +22,7 @@ import (
|
||||
type World struct {
|
||||
c bot.Client
|
||||
|
||||
Columns map[level.ChunkPos]*level.Chunk
|
||||
|
||||
columns map[level.ChunkPos]*level.Chunk
|
||||
entities map[int32]*Entity
|
||||
|
||||
entityLock sync.Mutex
|
||||
@ -32,30 +31,34 @@ type World struct {
|
||||
|
||||
func NewWorld(c bot.Client) *World {
|
||||
w := &World{
|
||||
c: c,
|
||||
Columns: make(map[level.ChunkPos]*level.Chunk),
|
||||
c: c,
|
||||
columns: make(map[level.ChunkPos]*level.Chunk),
|
||||
entities: make(map[int32]*Entity),
|
||||
}
|
||||
|
||||
bot.AddHandler(c, func(ctx context.Context, p *cp.LevelChunkWithLight) {
|
||||
w.chunkLock.Lock()
|
||||
defer w.chunkLock.Unlock()
|
||||
|
||||
w.Columns[p.Pos] = p.Data
|
||||
w.columns[p.Pos] = p.Data
|
||||
})
|
||||
bot.AddHandler(c, func(ctx context.Context, p *cp.ForgetLevelChunk) {
|
||||
w.chunkLock.Lock()
|
||||
defer w.chunkLock.Unlock()
|
||||
|
||||
delete(w.Columns, p.Pos)
|
||||
delete(w.columns, p.Pos)
|
||||
})
|
||||
bot.AddHandler(c, func(ctx context.Context, p *cp.Respawn) {
|
||||
w.chunkLock.Lock()
|
||||
defer w.chunkLock.Unlock()
|
||||
|
||||
w.Columns = make(map[level.ChunkPos]*level.Chunk)
|
||||
w.columns = make(map[level.ChunkPos]*level.Chunk)
|
||||
})
|
||||
|
||||
bot.AddHandler(c, func(ctx context.Context, p *cp.AddEntity) {
|
||||
w.entityLock.Lock()
|
||||
defer w.entityLock.Unlock()
|
||||
|
||||
w.entities[p.ID] = &Entity{
|
||||
id: p.ID,
|
||||
entityUUID: p.UUID,
|
||||
@ -137,7 +140,7 @@ func (w *World) GetBlock(pos protocol.Position) (block.Block, error) {
|
||||
chunkZ := pos[2] >> 4
|
||||
pos2d := level.ChunkPos{chunkX, chunkZ}
|
||||
|
||||
chunk, ok := w.Columns[pos2d]
|
||||
chunk, ok := w.columns[pos2d]
|
||||
if !ok {
|
||||
return nil, errors.New("chunk not loaded")
|
||||
}
|
||||
@ -161,7 +164,7 @@ func (w *World) SetBlock(pos protocol.Position, blk block.Block) error {
|
||||
chunkZ := pos[2] >> 4
|
||||
pos2d := level.ChunkPos{chunkX, chunkZ}
|
||||
|
||||
chunk, ok := w.Columns[pos2d]
|
||||
chunk, ok := w.columns[pos2d]
|
||||
if !ok {
|
||||
return errors.New("chunk not loaded")
|
||||
}
|
||||
|
@ -3602,10 +3602,10 @@ func (c WrittenBookPage) WriteTo(w io.Writer) (n int64, err error) {
|
||||
return n, err
|
||||
}
|
||||
|
||||
// Float32VarIntArray a utility type for encoding/decoding packet.Float -> float32[packet.VarInt] slice.
|
||||
type Float32VarIntArray []float32
|
||||
// Int32VarIntArray a utility type for encoding/decoding packet.Int -> int32[packet.VarInt] slice.
|
||||
type Int32VarIntArray []int32
|
||||
|
||||
func (a Float32VarIntArray) WriteTo(w io.Writer) (n int64, err error) {
|
||||
func (a Int32VarIntArray) WriteTo(w io.Writer) (n int64, err error) {
|
||||
size := len(a)
|
||||
nn, err := packet.VarInt(size).WriteTo(w)
|
||||
if err != nil {
|
||||
@ -3613,7 +3613,7 @@ func (a Float32VarIntArray) WriteTo(w io.Writer) (n int64, err error) {
|
||||
}
|
||||
n += nn
|
||||
for i := 0; i < size; i++ {
|
||||
nn, err := packet.Float(a[i]).WriteTo(w)
|
||||
nn, err := packet.Int(a[i]).WriteTo(w)
|
||||
n += nn
|
||||
if err != nil {
|
||||
return n, err
|
||||
@ -3622,7 +3622,7 @@ func (a Float32VarIntArray) WriteTo(w io.Writer) (n int64, err error) {
|
||||
return n, nil
|
||||
}
|
||||
|
||||
func (a *Float32VarIntArray) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
func (a *Int32VarIntArray) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
var size packet.VarInt
|
||||
nn, err := size.ReadFrom(r)
|
||||
n += nn
|
||||
@ -3636,11 +3636,59 @@ func (a *Float32VarIntArray) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
if cap(*a) >= int(size) {
|
||||
*a = (*a)[:int(size)]
|
||||
} else {
|
||||
*a = make(Float32VarIntArray, int(size))
|
||||
*a = make(Int32VarIntArray, int(size))
|
||||
}
|
||||
|
||||
for i := 0; i < int(size); i++ {
|
||||
nn, err = (*packet.Float)(&(*a)[i]).ReadFrom(r)
|
||||
nn, err = (*packet.Int)(&(*a)[i]).ReadFrom(r)
|
||||
n += nn
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
}
|
||||
|
||||
return n, err
|
||||
}
|
||||
|
||||
// Int32PrefixedArrayVarIntArray a utility type for encoding/decoding packet.Int -> int32[packet.VarInt] slice.
|
||||
type Int32PrefixedArrayVarIntArray []int32
|
||||
|
||||
func (a Int32PrefixedArrayVarIntArray) WriteTo(w io.Writer) (n int64, err error) {
|
||||
size := len(a)
|
||||
nn, err := packet.VarInt(size).WriteTo(w)
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
n += nn
|
||||
for i := 0; i < size; i++ {
|
||||
nn, err := packet.Int(a[i]).WriteTo(w)
|
||||
n += nn
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
}
|
||||
return n, nil
|
||||
}
|
||||
|
||||
func (a *Int32PrefixedArrayVarIntArray) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
var size packet.VarInt
|
||||
nn, err := size.ReadFrom(r)
|
||||
n += nn
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
if size < 0 {
|
||||
return n, errors.New("array length less than zero")
|
||||
}
|
||||
|
||||
if cap(*a) >= int(size) {
|
||||
*a = (*a)[:int(size)]
|
||||
} else {
|
||||
*a = make(Int32PrefixedArrayVarIntArray, int(size))
|
||||
}
|
||||
|
||||
for i := 0; i < int(size); i++ {
|
||||
nn, err = (*packet.Int)(&(*a)[i]).ReadFrom(r)
|
||||
n += nn
|
||||
if err != nil {
|
||||
return n, err
|
||||
@ -3794,10 +3842,10 @@ func (a *Int32VarIntVarIntArray) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
return n, err
|
||||
}
|
||||
|
||||
// Int32VarIntArray a utility type for encoding/decoding packet.Int -> int32[packet.VarInt] slice.
|
||||
type Int32VarIntArray []int32
|
||||
// Float32VarIntArray a utility type for encoding/decoding packet.Float -> float32[packet.VarInt] slice.
|
||||
type Float32VarIntArray []float32
|
||||
|
||||
func (a Int32VarIntArray) WriteTo(w io.Writer) (n int64, err error) {
|
||||
func (a Float32VarIntArray) WriteTo(w io.Writer) (n int64, err error) {
|
||||
size := len(a)
|
||||
nn, err := packet.VarInt(size).WriteTo(w)
|
||||
if err != nil {
|
||||
@ -3805,7 +3853,7 @@ func (a Int32VarIntArray) WriteTo(w io.Writer) (n int64, err error) {
|
||||
}
|
||||
n += nn
|
||||
for i := 0; i < size; i++ {
|
||||
nn, err := packet.Int(a[i]).WriteTo(w)
|
||||
nn, err := packet.Float(a[i]).WriteTo(w)
|
||||
n += nn
|
||||
if err != nil {
|
||||
return n, err
|
||||
@ -3814,7 +3862,7 @@ func (a Int32VarIntArray) WriteTo(w io.Writer) (n int64, err error) {
|
||||
return n, nil
|
||||
}
|
||||
|
||||
func (a *Int32VarIntArray) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
func (a *Float32VarIntArray) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
var size packet.VarInt
|
||||
nn, err := size.ReadFrom(r)
|
||||
n += nn
|
||||
@ -3828,59 +3876,11 @@ func (a *Int32VarIntArray) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
if cap(*a) >= int(size) {
|
||||
*a = (*a)[:int(size)]
|
||||
} else {
|
||||
*a = make(Int32VarIntArray, int(size))
|
||||
*a = make(Float32VarIntArray, int(size))
|
||||
}
|
||||
|
||||
for i := 0; i < int(size); i++ {
|
||||
nn, err = (*packet.Int)(&(*a)[i]).ReadFrom(r)
|
||||
n += nn
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
}
|
||||
|
||||
return n, err
|
||||
}
|
||||
|
||||
// Int32PrefixedArrayVarIntArray a utility type for encoding/decoding packet.Int -> int32[packet.VarInt] slice.
|
||||
type Int32PrefixedArrayVarIntArray []int32
|
||||
|
||||
func (a Int32PrefixedArrayVarIntArray) WriteTo(w io.Writer) (n int64, err error) {
|
||||
size := len(a)
|
||||
nn, err := packet.VarInt(size).WriteTo(w)
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
n += nn
|
||||
for i := 0; i < size; i++ {
|
||||
nn, err := packet.Int(a[i]).WriteTo(w)
|
||||
n += nn
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
}
|
||||
return n, nil
|
||||
}
|
||||
|
||||
func (a *Int32PrefixedArrayVarIntArray) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
var size packet.VarInt
|
||||
nn, err := size.ReadFrom(r)
|
||||
n += nn
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
if size < 0 {
|
||||
return n, errors.New("array length less than zero")
|
||||
}
|
||||
|
||||
if cap(*a) >= int(size) {
|
||||
*a = (*a)[:int(size)]
|
||||
} else {
|
||||
*a = make(Int32PrefixedArrayVarIntArray, int(size))
|
||||
}
|
||||
|
||||
for i := 0; i < int(size); i++ {
|
||||
nn, err = (*packet.Int)(&(*a)[i]).ReadFrom(r)
|
||||
nn, err = (*packet.Float)(&(*a)[i]).ReadFrom(r)
|
||||
n += nn
|
||||
if err != nil {
|
||||
return n, err
|
||||
|
@ -84,6 +84,7 @@ func (m EntityMetadata) WriteTo(w io.Writer) (int64, error) {
|
||||
}
|
||||
|
||||
func (m *EntityMetadata) ReadFrom(r io.Reader) (int64, error) {
|
||||
m.Data = make(map[uint8]Metadata)
|
||||
var index uint8
|
||||
n, err := (*pk.UnsignedByte)(&index).ReadFrom(r)
|
||||
if err != nil {
|
||||
|
@ -6,7 +6,7 @@ import "github.com/Tnze/go-mc/data/packetid"
|
||||
type ConfigClearDialog struct {
|
||||
}
|
||||
|
||||
func (ConfigClearDialog) PacketID() packetid.ClientboundPacketID {
|
||||
func (*ConfigClearDialog) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundConfigClearDialog
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ type ConfigCookieRequest struct {
|
||||
Key string `mc:"Identifier"`
|
||||
}
|
||||
|
||||
func (ConfigCookieRequest) PacketID() packetid.ClientboundPacketID {
|
||||
func (*ConfigCookieRequest) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundConfigCookieRequest
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ type ConfigCustomPayload struct {
|
||||
Data []byte `mc:"ByteArray"`
|
||||
}
|
||||
|
||||
func (ConfigCustomPayload) PacketID() packetid.ClientboundPacketID {
|
||||
func (*ConfigCustomPayload) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundConfigCustomPayload
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ type ConfigCustomReportDetails struct {
|
||||
client.CustomReportDetails
|
||||
}
|
||||
|
||||
func (ConfigCustomReportDetails) PacketID() packetid.ClientboundPacketID {
|
||||
func (*ConfigCustomReportDetails) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundConfigCustomReportDetails
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ type ConfigDisconnect struct {
|
||||
Reason chat.Message
|
||||
}
|
||||
|
||||
func (ConfigDisconnect) PacketID() packetid.ClientboundPacketID {
|
||||
func (*ConfigDisconnect) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundConfigDisconnect
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ import "github.com/Tnze/go-mc/data/packetid"
|
||||
type ConfigFinishConfiguration struct {
|
||||
}
|
||||
|
||||
func (ConfigFinishConfiguration) PacketID() packetid.ClientboundPacketID {
|
||||
func (*ConfigFinishConfiguration) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundConfigFinishConfiguration
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ type ConfigKeepAlive struct {
|
||||
ID int64
|
||||
}
|
||||
|
||||
func (ConfigKeepAlive) PacketID() packetid.ClientboundPacketID {
|
||||
func (*ConfigKeepAlive) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundConfigKeepAlive
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ type ConfigPing struct {
|
||||
ID int32
|
||||
}
|
||||
|
||||
func (ConfigPing) PacketID() packetid.ClientboundPacketID {
|
||||
func (*ConfigPing) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundConfigPing
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ type ConfigRegistryData struct {
|
||||
Data []RegistryData
|
||||
}
|
||||
|
||||
func (ConfigRegistryData) PacketID() packetid.ClientboundPacketID {
|
||||
func (*ConfigRegistryData) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundConfigRegistryData
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ import "github.com/Tnze/go-mc/data/packetid"
|
||||
type ConfigResetChat struct {
|
||||
}
|
||||
|
||||
func (ConfigResetChat) PacketID() packetid.ClientboundPacketID {
|
||||
func (*ConfigResetChat) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundConfigResetChat
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ type ConfigResourcePackPop struct {
|
||||
client.RemoveResourcePack
|
||||
}
|
||||
|
||||
func (ConfigResourcePackPop) PacketID() packetid.ClientboundPacketID {
|
||||
func (*ConfigResourcePackPop) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundConfigResourcePackPop
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ type ConfigResourcePackPush struct {
|
||||
client.AddResourcePack
|
||||
}
|
||||
|
||||
func (ConfigResourcePackPush) PacketID() packetid.ClientboundPacketID {
|
||||
func (*ConfigResourcePackPush) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundConfigResourcePackPush
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ type ConfigSelectKnownPacks struct {
|
||||
KnownPacks []KnownPack
|
||||
}
|
||||
|
||||
func (ConfigSelectKnownPacks) PacketID() packetid.ClientboundPacketID {
|
||||
func (*ConfigSelectKnownPacks) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundConfigSelectKnownPacks
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ type ConfigServerLinks struct {
|
||||
client.ServerLinks
|
||||
}
|
||||
|
||||
func (ConfigServerLinks) PacketID() packetid.ClientboundPacketID {
|
||||
func (*ConfigServerLinks) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundConfigServerLinks
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ type ConfigShowDialog struct {
|
||||
client.ShowDialog
|
||||
}
|
||||
|
||||
func (ConfigShowDialog) PacketID() packetid.ClientboundPacketID {
|
||||
func (*ConfigShowDialog) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundConfigShowDialog
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ type ConfigStoreCookie struct {
|
||||
Payload []int8
|
||||
}
|
||||
|
||||
func (ConfigStoreCookie) PacketID() packetid.ClientboundPacketID {
|
||||
func (*ConfigStoreCookie) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundConfigStoreCookie
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ type ConfigTransfer struct {
|
||||
Port int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (ConfigTransfer) PacketID() packetid.ClientboundPacketID {
|
||||
func (*ConfigTransfer) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundConfigTransfer
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ type ConfigUpdateEnabledFeatures struct {
|
||||
Features []string `mc:"Identifier"`
|
||||
}
|
||||
|
||||
func (ConfigUpdateEnabledFeatures) PacketID() packetid.ClientboundPacketID {
|
||||
func (*ConfigUpdateEnabledFeatures) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundConfigUpdateEnabledFeatures
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ type ConfigUpdateTags struct {
|
||||
client.UpdateTags
|
||||
}
|
||||
|
||||
func (ConfigUpdateTags) PacketID() packetid.ClientboundPacketID {
|
||||
func (*ConfigUpdateTags) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundConfigUpdateTags
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ type ConfigClientInformation struct {
|
||||
server.ClientInformation
|
||||
}
|
||||
|
||||
func (ConfigClientInformation) PacketID() packetid.ServerboundPacketID {
|
||||
func (*ConfigClientInformation) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundConfigClientInformation
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ type ConfigCookieResponse struct {
|
||||
server.CookieResponse
|
||||
}
|
||||
|
||||
func (ConfigCookieResponse) PacketID() packetid.ServerboundPacketID {
|
||||
func (*ConfigCookieResponse) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundConfigCookieResponse
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ type ConfigCustomClickAction struct {
|
||||
Data nbt.RawMessage `mc:"NBT"`
|
||||
}
|
||||
|
||||
func (ConfigCustomClickAction) PacketID() packetid.ServerboundPacketID {
|
||||
func (*ConfigCustomClickAction) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundConfigCustomClickAction
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ type ConfigCustomPayload struct {
|
||||
server.CustomPayload
|
||||
}
|
||||
|
||||
func (ConfigCustomPayload) PacketID() packetid.ServerboundPacketID {
|
||||
func (*ConfigCustomPayload) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundConfigCustomPayload
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ import "github.com/Tnze/go-mc/data/packetid"
|
||||
type ConfigFinishConfiguration struct {
|
||||
}
|
||||
|
||||
func (ConfigFinishConfiguration) PacketID() packetid.ServerboundPacketID {
|
||||
func (*ConfigFinishConfiguration) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundConfigFinishConfiguration
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ type ConfigKeepAlive struct {
|
||||
ID int64
|
||||
}
|
||||
|
||||
func (ConfigKeepAlive) PacketID() packetid.ServerboundPacketID {
|
||||
func (*ConfigKeepAlive) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundConfigKeepAlive
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ type ConfigPong struct {
|
||||
ID int32
|
||||
}
|
||||
|
||||
func (ConfigPong) PacketID() packetid.ServerboundPacketID {
|
||||
func (*ConfigPong) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundConfigPong
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ type ConfigResourcePack struct {
|
||||
server.ResourcePack
|
||||
}
|
||||
|
||||
func (ConfigResourcePack) PacketID() packetid.ServerboundPacketID {
|
||||
func (*ConfigResourcePack) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundConfigResourcePack
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ type ConfigSelectKnownPacks struct {
|
||||
Packs []client.KnownPack
|
||||
}
|
||||
|
||||
func (ConfigSelectKnownPacks) PacketID() packetid.ServerboundPacketID {
|
||||
func (*ConfigSelectKnownPacks) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundConfigSelectKnownPacks
|
||||
}
|
||||
|
||||
|
@ -818,33 +818,11 @@ func (c CommandSuggestions) WriteTo(w io.Writer) (n int64, err error) {
|
||||
return n, err
|
||||
}
|
||||
func (c *Commands) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
var temp int64
|
||||
temp, err = packet.Array(&c.Nodes).ReadFrom(r)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
temp, err = (*packet.VarInt)(&c.RootIndex).ReadFrom(r)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
return n, err
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
func (c Commands) WriteTo(w io.Writer) (n int64, err error) {
|
||||
var temp int64
|
||||
temp, err = packet.Array(&c.Nodes).WriteTo(w)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
temp, err = (*packet.VarInt)(&c.RootIndex).WriteTo(w)
|
||||
n += temp
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
return n, err
|
||||
return 0, nil
|
||||
}
|
||||
func (c *SetContainerContent) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
var temp int64
|
||||
@ -1557,7 +1535,6 @@ func (c Explode) WriteTo(w io.Writer) (n int64, err error) {
|
||||
}
|
||||
return n, err
|
||||
}
|
||||
|
||||
func (c *ForgetLevelChunk) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
var temp int64
|
||||
temp, err = (&c.Pos).ReadFrom(r)
|
||||
@ -7090,150 +7067,6 @@ func (c Waypoint) WriteTo(w io.Writer) (n int64, err error) {
|
||||
return n, err
|
||||
}
|
||||
|
||||
// StringVarIntArray a utility type for encoding/decoding packet.String -> string[packet.VarInt] slice.
|
||||
type StringVarIntArray []string
|
||||
|
||||
func (a StringVarIntArray) WriteTo(w io.Writer) (n int64, err error) {
|
||||
size := len(a)
|
||||
nn, err := packet.VarInt(size).WriteTo(w)
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
n += nn
|
||||
for i := 0; i < size; i++ {
|
||||
nn, err := packet.String(a[i]).WriteTo(w)
|
||||
n += nn
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
}
|
||||
return n, nil
|
||||
}
|
||||
|
||||
func (a *StringVarIntArray) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
var size packet.VarInt
|
||||
nn, err := size.ReadFrom(r)
|
||||
n += nn
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
if size < 0 {
|
||||
return n, errors.New("array length less than zero")
|
||||
}
|
||||
|
||||
if cap(*a) >= int(size) {
|
||||
*a = (*a)[:int(size)]
|
||||
} else {
|
||||
*a = make(StringVarIntArray, int(size))
|
||||
}
|
||||
|
||||
for i := 0; i < int(size); i++ {
|
||||
nn, err = (*packet.String)(&(*a)[i]).ReadFrom(r)
|
||||
n += nn
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
}
|
||||
|
||||
return n, err
|
||||
}
|
||||
|
||||
// UuidUUIDUUIDVarIntArray a utility type for encoding/decoding packet.UUID -> uuid.UUID[packet.VarInt] slice.
|
||||
type UuidUUIDUUIDVarIntArray []uuid.UUID
|
||||
|
||||
func (a UuidUUIDUUIDVarIntArray) WriteTo(w io.Writer) (n int64, err error) {
|
||||
size := len(a)
|
||||
nn, err := packet.VarInt(size).WriteTo(w)
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
n += nn
|
||||
for i := 0; i < size; i++ {
|
||||
nn, err := packet.UUID(a[i]).WriteTo(w)
|
||||
n += nn
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
}
|
||||
return n, nil
|
||||
}
|
||||
|
||||
func (a *UuidUUIDUUIDVarIntArray) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
var size packet.VarInt
|
||||
nn, err := size.ReadFrom(r)
|
||||
n += nn
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
if size < 0 {
|
||||
return n, errors.New("array length less than zero")
|
||||
}
|
||||
|
||||
if cap(*a) >= int(size) {
|
||||
*a = (*a)[:int(size)]
|
||||
} else {
|
||||
*a = make(UuidUUIDUUIDVarIntArray, int(size))
|
||||
}
|
||||
|
||||
for i := 0; i < int(size); i++ {
|
||||
nn, err = (*packet.UUID)(&(*a)[i]).ReadFrom(r)
|
||||
n += nn
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
}
|
||||
|
||||
return n, err
|
||||
}
|
||||
|
||||
// Int32VarIntVarIntArray a utility type for encoding/decoding packet.VarInt -> int32[packet.VarInt] slice.
|
||||
type Int32VarIntVarIntArray []int32
|
||||
|
||||
func (a Int32VarIntVarIntArray) WriteTo(w io.Writer) (n int64, err error) {
|
||||
size := len(a)
|
||||
nn, err := packet.VarInt(size).WriteTo(w)
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
n += nn
|
||||
for i := 0; i < size; i++ {
|
||||
nn, err := packet.VarInt(a[i]).WriteTo(w)
|
||||
n += nn
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
}
|
||||
return n, nil
|
||||
}
|
||||
|
||||
func (a *Int32VarIntVarIntArray) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
var size packet.VarInt
|
||||
nn, err := size.ReadFrom(r)
|
||||
n += nn
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
if size < 0 {
|
||||
return n, errors.New("array length less than zero")
|
||||
}
|
||||
|
||||
if cap(*a) >= int(size) {
|
||||
*a = (*a)[:int(size)]
|
||||
} else {
|
||||
*a = make(Int32VarIntVarIntArray, int(size))
|
||||
}
|
||||
|
||||
for i := 0; i < int(size); i++ {
|
||||
nn, err = (*packet.VarInt)(&(*a)[i]).ReadFrom(r)
|
||||
n += nn
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
}
|
||||
|
||||
return n, err
|
||||
}
|
||||
|
||||
// Int64VarLongVarIntArray a utility type for encoding/decoding packet.VarLong -> int64[packet.VarInt] slice.
|
||||
type Int64VarLongVarIntArray []int64
|
||||
|
||||
@ -7282,6 +7115,54 @@ func (a *Int64VarLongVarIntArray) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
return n, err
|
||||
}
|
||||
|
||||
// Int8ByteVarIntArray a utility type for encoding/decoding packet.Byte -> int8[packet.VarInt] slice.
|
||||
type Int8ByteVarIntArray []int8
|
||||
|
||||
func (a Int8ByteVarIntArray) WriteTo(w io.Writer) (n int64, err error) {
|
||||
size := len(a)
|
||||
nn, err := packet.VarInt(size).WriteTo(w)
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
n += nn
|
||||
for i := 0; i < size; i++ {
|
||||
nn, err := packet.Byte(a[i]).WriteTo(w)
|
||||
n += nn
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
}
|
||||
return n, nil
|
||||
}
|
||||
|
||||
func (a *Int8ByteVarIntArray) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
var size packet.VarInt
|
||||
nn, err := size.ReadFrom(r)
|
||||
n += nn
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
if size < 0 {
|
||||
return n, errors.New("array length less than zero")
|
||||
}
|
||||
|
||||
if cap(*a) >= int(size) {
|
||||
*a = (*a)[:int(size)]
|
||||
} else {
|
||||
*a = make(Int8ByteVarIntArray, int(size))
|
||||
}
|
||||
|
||||
for i := 0; i < int(size); i++ {
|
||||
nn, err = (*packet.Byte)(&(*a)[i]).ReadFrom(r)
|
||||
n += nn
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
}
|
||||
|
||||
return n, err
|
||||
}
|
||||
|
||||
// Int8VarIntArray a utility type for encoding/decoding packet.Byte -> int8[packet.VarInt] slice.
|
||||
type Int8VarIntArray []int8
|
||||
|
||||
@ -7426,10 +7307,10 @@ func (a *StringIdentifierVarIntArray) ReadFrom(r io.Reader) (n int64, err error)
|
||||
return n, err
|
||||
}
|
||||
|
||||
// Int8ByteVarIntArray a utility type for encoding/decoding packet.Byte -> int8[packet.VarInt] slice.
|
||||
type Int8ByteVarIntArray []int8
|
||||
// UuidUUIDUUIDVarIntArray a utility type for encoding/decoding packet.UUID -> uuid.UUID[packet.VarInt] slice.
|
||||
type UuidUUIDUUIDVarIntArray []uuid.UUID
|
||||
|
||||
func (a Int8ByteVarIntArray) WriteTo(w io.Writer) (n int64, err error) {
|
||||
func (a UuidUUIDUUIDVarIntArray) WriteTo(w io.Writer) (n int64, err error) {
|
||||
size := len(a)
|
||||
nn, err := packet.VarInt(size).WriteTo(w)
|
||||
if err != nil {
|
||||
@ -7437,7 +7318,7 @@ func (a Int8ByteVarIntArray) WriteTo(w io.Writer) (n int64, err error) {
|
||||
}
|
||||
n += nn
|
||||
for i := 0; i < size; i++ {
|
||||
nn, err := packet.Byte(a[i]).WriteTo(w)
|
||||
nn, err := packet.UUID(a[i]).WriteTo(w)
|
||||
n += nn
|
||||
if err != nil {
|
||||
return n, err
|
||||
@ -7446,7 +7327,7 @@ func (a Int8ByteVarIntArray) WriteTo(w io.Writer) (n int64, err error) {
|
||||
return n, nil
|
||||
}
|
||||
|
||||
func (a *Int8ByteVarIntArray) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
func (a *UuidUUIDUUIDVarIntArray) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
var size packet.VarInt
|
||||
nn, err := size.ReadFrom(r)
|
||||
n += nn
|
||||
@ -7460,11 +7341,59 @@ func (a *Int8ByteVarIntArray) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
if cap(*a) >= int(size) {
|
||||
*a = (*a)[:int(size)]
|
||||
} else {
|
||||
*a = make(Int8ByteVarIntArray, int(size))
|
||||
*a = make(UuidUUIDUUIDVarIntArray, int(size))
|
||||
}
|
||||
|
||||
for i := 0; i < int(size); i++ {
|
||||
nn, err = (*packet.Byte)(&(*a)[i]).ReadFrom(r)
|
||||
nn, err = (*packet.UUID)(&(*a)[i]).ReadFrom(r)
|
||||
n += nn
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
}
|
||||
|
||||
return n, err
|
||||
}
|
||||
|
||||
// Int32VarIntVarIntArray a utility type for encoding/decoding packet.VarInt -> int32[packet.VarInt] slice.
|
||||
type Int32VarIntVarIntArray []int32
|
||||
|
||||
func (a Int32VarIntVarIntArray) WriteTo(w io.Writer) (n int64, err error) {
|
||||
size := len(a)
|
||||
nn, err := packet.VarInt(size).WriteTo(w)
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
n += nn
|
||||
for i := 0; i < size; i++ {
|
||||
nn, err := packet.VarInt(a[i]).WriteTo(w)
|
||||
n += nn
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
}
|
||||
return n, nil
|
||||
}
|
||||
|
||||
func (a *Int32VarIntVarIntArray) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
var size packet.VarInt
|
||||
nn, err := size.ReadFrom(r)
|
||||
n += nn
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
if size < 0 {
|
||||
return n, errors.New("array length less than zero")
|
||||
}
|
||||
|
||||
if cap(*a) >= int(size) {
|
||||
*a = (*a)[:int(size)]
|
||||
} else {
|
||||
*a = make(Int32VarIntVarIntArray, int(size))
|
||||
}
|
||||
|
||||
for i := 0; i < int(size); i++ {
|
||||
nn, err = (*packet.VarInt)(&(*a)[i]).ReadFrom(r)
|
||||
n += nn
|
||||
if err != nil {
|
||||
return n, err
|
||||
@ -7521,3 +7450,51 @@ func (a *StringStringVarIntArray) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
|
||||
return n, err
|
||||
}
|
||||
|
||||
// StringVarIntArray a utility type for encoding/decoding packet.String -> string[packet.VarInt] slice.
|
||||
type StringVarIntArray []string
|
||||
|
||||
func (a StringVarIntArray) WriteTo(w io.Writer) (n int64, err error) {
|
||||
size := len(a)
|
||||
nn, err := packet.VarInt(size).WriteTo(w)
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
n += nn
|
||||
for i := 0; i < size; i++ {
|
||||
nn, err := packet.String(a[i]).WriteTo(w)
|
||||
n += nn
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
}
|
||||
return n, nil
|
||||
}
|
||||
|
||||
func (a *StringVarIntArray) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
var size packet.VarInt
|
||||
nn, err := size.ReadFrom(r)
|
||||
n += nn
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
if size < 0 {
|
||||
return n, errors.New("array length less than zero")
|
||||
}
|
||||
|
||||
if cap(*a) >= int(size) {
|
||||
*a = (*a)[:int(size)]
|
||||
} else {
|
||||
*a = make(StringVarIntArray, int(size))
|
||||
}
|
||||
|
||||
for i := 0; i < int(size); i++ {
|
||||
nn, err = (*packet.String)(&(*a)[i]).ReadFrom(r)
|
||||
n += nn
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
}
|
||||
|
||||
return n, err
|
||||
}
|
||||
|
@ -1,9 +1,5 @@
|
||||
package client
|
||||
|
||||
import "github.com/Tnze/go-mc/server/command"
|
||||
|
||||
//codec:gen
|
||||
type Commands struct {
|
||||
Nodes []command.Node
|
||||
RootIndex int32 `mc:"VarInt"`
|
||||
}
|
||||
|
@ -418,399 +418,399 @@ func registerPacket(creator clientBoundPacketCreator) {
|
||||
ClientboundPackets[creator().PacketID()] = creator
|
||||
}
|
||||
|
||||
func (AddEntity) PacketID() packetid.ClientboundPacketID {
|
||||
func (*AddEntity) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundAddEntity
|
||||
}
|
||||
func (Animate) PacketID() packetid.ClientboundPacketID {
|
||||
func (*Animate) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundAnimate
|
||||
}
|
||||
func (AwardStats) PacketID() packetid.ClientboundPacketID {
|
||||
func (*AwardStats) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundAwardStats
|
||||
}
|
||||
func (BlockChangedAck) PacketID() packetid.ClientboundPacketID {
|
||||
func (*BlockChangedAck) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundBlockChangedAck
|
||||
}
|
||||
func (BlockDestruction) PacketID() packetid.ClientboundPacketID {
|
||||
func (*BlockDestruction) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundBlockDestruction
|
||||
}
|
||||
func (BlockEntityData) PacketID() packetid.ClientboundPacketID {
|
||||
func (*BlockEntityData) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundBlockEntityData
|
||||
}
|
||||
func (BlockEvent) PacketID() packetid.ClientboundPacketID {
|
||||
func (*BlockEvent) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundBlockEvent
|
||||
}
|
||||
func (BlockUpdate) PacketID() packetid.ClientboundPacketID {
|
||||
func (*BlockUpdate) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundBlockUpdate
|
||||
}
|
||||
func (BossEvent) PacketID() packetid.ClientboundPacketID {
|
||||
func (*BossEvent) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundBossEvent
|
||||
}
|
||||
func (ChangeDifficulty) PacketID() packetid.ClientboundPacketID {
|
||||
func (*ChangeDifficulty) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundChangeDifficulty
|
||||
}
|
||||
func (ChunkBatchFinished) PacketID() packetid.ClientboundPacketID {
|
||||
func (*ChunkBatchFinished) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundChunkBatchFinished
|
||||
}
|
||||
func (ChunkBatchStart) PacketID() packetid.ClientboundPacketID {
|
||||
func (*ChunkBatchStart) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundChunkBatchStart
|
||||
}
|
||||
func (ChunkBiomes) PacketID() packetid.ClientboundPacketID {
|
||||
func (*ChunkBiomes) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundChunksBiomes
|
||||
}
|
||||
func (ClearTitles) PacketID() packetid.ClientboundPacketID {
|
||||
func (*ClearTitles) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundClearTitles
|
||||
}
|
||||
func (CommandSuggestions) PacketID() packetid.ClientboundPacketID {
|
||||
func (*CommandSuggestions) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundCommandSuggestions
|
||||
}
|
||||
func (Commands) PacketID() packetid.ClientboundPacketID {
|
||||
func (*Commands) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundCommands
|
||||
}
|
||||
func (CloseContainer) PacketID() packetid.ClientboundPacketID {
|
||||
func (*CloseContainer) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundContainerClose
|
||||
}
|
||||
func (SetContainerContent) PacketID() packetid.ClientboundPacketID {
|
||||
func (*SetContainerContent) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundContainerSetContent
|
||||
}
|
||||
func (ContainerSetData) PacketID() packetid.ClientboundPacketID {
|
||||
func (*ContainerSetData) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundContainerSetData
|
||||
}
|
||||
func (ContainerSetSlot) PacketID() packetid.ClientboundPacketID {
|
||||
func (*ContainerSetSlot) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundContainerSetSlot
|
||||
}
|
||||
func (CookieRequest) PacketID() packetid.ClientboundPacketID {
|
||||
func (*CookieRequest) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundCookieRequest
|
||||
}
|
||||
func (Cooldown) PacketID() packetid.ClientboundPacketID {
|
||||
func (*Cooldown) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundCooldown
|
||||
}
|
||||
func (CustomChatCompletions) PacketID() packetid.ClientboundPacketID {
|
||||
func (*CustomChatCompletions) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundCustomChatCompletions
|
||||
}
|
||||
func (CustomPayload) PacketID() packetid.ClientboundPacketID {
|
||||
func (*CustomPayload) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundCustomPayload
|
||||
}
|
||||
func (DamageEvent) PacketID() packetid.ClientboundPacketID {
|
||||
func (*DamageEvent) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundDamageEvent
|
||||
}
|
||||
func (DebugSample) PacketID() packetid.ClientboundPacketID {
|
||||
func (*DebugSample) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundDebugSample
|
||||
}
|
||||
func (DeleteChat) PacketID() packetid.ClientboundPacketID {
|
||||
func (*DeleteChat) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundDeleteChat
|
||||
}
|
||||
func (Disconnect) PacketID() packetid.ClientboundPacketID {
|
||||
func (*Disconnect) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundDisconnect
|
||||
}
|
||||
func (DisguisedChat) PacketID() packetid.ClientboundPacketID {
|
||||
func (*DisguisedChat) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundDisguisedChat
|
||||
}
|
||||
func (EntityEvent) PacketID() packetid.ClientboundPacketID {
|
||||
func (*EntityEvent) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundEntityEvent
|
||||
}
|
||||
func (TeleportEntity) PacketID() packetid.ClientboundPacketID {
|
||||
func (*TeleportEntity) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundEntityPositionSync
|
||||
}
|
||||
func (Explode) PacketID() packetid.ClientboundPacketID {
|
||||
func (*Explode) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundExplode
|
||||
}
|
||||
func (ForgetLevelChunk) PacketID() packetid.ClientboundPacketID {
|
||||
func (*ForgetLevelChunk) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundForgetLevelChunk
|
||||
}
|
||||
func (GameEvent) PacketID() packetid.ClientboundPacketID {
|
||||
func (*GameEvent) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundGameEvent
|
||||
}
|
||||
func (OpenHorseScreen) PacketID() packetid.ClientboundPacketID {
|
||||
func (*OpenHorseScreen) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundHorseScreenOpen
|
||||
}
|
||||
func (HurtAnimation) PacketID() packetid.ClientboundPacketID {
|
||||
func (*HurtAnimation) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundHurtAnimation
|
||||
}
|
||||
func (InitializeWorldBorder) PacketID() packetid.ClientboundPacketID {
|
||||
func (*InitializeWorldBorder) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundInitializeBorder
|
||||
}
|
||||
func (KeepAlive) PacketID() packetid.ClientboundPacketID {
|
||||
func (*KeepAlive) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundKeepAlive
|
||||
}
|
||||
func (LevelChunkWithLight) PacketID() packetid.ClientboundPacketID {
|
||||
func (*LevelChunkWithLight) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundLevelChunkWithLight
|
||||
}
|
||||
func (LevelEvent) PacketID() packetid.ClientboundPacketID {
|
||||
func (*LevelEvent) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundLevelEvent
|
||||
}
|
||||
func (Particle) PacketID() packetid.ClientboundPacketID {
|
||||
func (*Particle) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundLevelParticles
|
||||
}
|
||||
func (UpdateLight) PacketID() packetid.ClientboundPacketID {
|
||||
func (*UpdateLight) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundLightUpdate
|
||||
}
|
||||
func (Login) PacketID() packetid.ClientboundPacketID {
|
||||
func (*Login) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundLogin
|
||||
}
|
||||
func (MapData) PacketID() packetid.ClientboundPacketID {
|
||||
func (*MapData) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundMapItemData
|
||||
}
|
||||
func (MerchantOffers) PacketID() packetid.ClientboundPacketID {
|
||||
func (*MerchantOffers) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundMerchantOffers
|
||||
}
|
||||
func (UpdateEntityPosition) PacketID() packetid.ClientboundPacketID {
|
||||
func (*UpdateEntityPosition) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundMoveEntityPos
|
||||
}
|
||||
func (UpdateEntityPositionAndRotation) PacketID() packetid.ClientboundPacketID {
|
||||
func (*UpdateEntityPositionAndRotation) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundMoveEntityPosRot
|
||||
}
|
||||
func (MoveMinecartAlongTrack) PacketID() packetid.ClientboundPacketID {
|
||||
func (*MoveMinecartAlongTrack) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundMoveMinecartAlongTrack
|
||||
}
|
||||
func (UpdateEntityRotation) PacketID() packetid.ClientboundPacketID {
|
||||
func (*UpdateEntityRotation) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundMoveEntityRot
|
||||
}
|
||||
func (MoveVehicle) PacketID() packetid.ClientboundPacketID {
|
||||
func (*MoveVehicle) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundMoveVehicle
|
||||
}
|
||||
func (OpenBook) PacketID() packetid.ClientboundPacketID {
|
||||
func (*OpenBook) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundOpenBook
|
||||
}
|
||||
func (OpenScreen) PacketID() packetid.ClientboundPacketID {
|
||||
func (*OpenScreen) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundOpenScreen
|
||||
}
|
||||
func (OpenSignEditor) PacketID() packetid.ClientboundPacketID {
|
||||
func (*OpenSignEditor) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundOpenSignEditor
|
||||
}
|
||||
func (Ping) PacketID() packetid.ClientboundPacketID {
|
||||
func (*Ping) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundPing
|
||||
}
|
||||
func (PingResponse) PacketID() packetid.ClientboundPacketID {
|
||||
func (*PingResponse) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundPongResponse
|
||||
}
|
||||
func (PlaceGhostRecipe) PacketID() packetid.ClientboundPacketID {
|
||||
func (*PlaceGhostRecipe) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundPlaceGhostRecipe
|
||||
}
|
||||
func (PlayerAbilities) PacketID() packetid.ClientboundPacketID {
|
||||
func (*PlayerAbilities) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundPlayerAbilities
|
||||
}
|
||||
func (EndCombat) PacketID() packetid.ClientboundPacketID {
|
||||
func (*EndCombat) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundPlayerCombatEnd
|
||||
}
|
||||
func (EnterCombat) PacketID() packetid.ClientboundPacketID {
|
||||
func (*EnterCombat) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundPlayerCombatEnter
|
||||
}
|
||||
func (CombatDeath) PacketID() packetid.ClientboundPacketID {
|
||||
func (*CombatDeath) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundPlayerCombatKill
|
||||
}
|
||||
func (PlayerInfoRemove) PacketID() packetid.ClientboundPacketID {
|
||||
func (*PlayerInfoRemove) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundPlayerInfoRemove
|
||||
}
|
||||
func (PlayerInfoUpdate) PacketID() packetid.ClientboundPacketID {
|
||||
func (*PlayerInfoUpdate) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundPlayerInfoUpdate
|
||||
}
|
||||
func (LookAt) PacketID() packetid.ClientboundPacketID {
|
||||
func (*LookAt) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundPlayerLookAt
|
||||
}
|
||||
func (PlayerPosition) PacketID() packetid.ClientboundPacketID {
|
||||
func (*PlayerPosition) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundPlayerPosition
|
||||
}
|
||||
func (PlayerRotation) PacketID() packetid.ClientboundPacketID {
|
||||
func (*PlayerRotation) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundPlayerRotation
|
||||
}
|
||||
func (RecipeBookAdd) PacketID() packetid.ClientboundPacketID {
|
||||
func (*RecipeBookAdd) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundRecipeBookAdd
|
||||
}
|
||||
func (RecipeBookRemove) PacketID() packetid.ClientboundPacketID {
|
||||
func (*RecipeBookRemove) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundRecipeBookRemove
|
||||
}
|
||||
func (RecipeBookSettings) PacketID() packetid.ClientboundPacketID {
|
||||
func (*RecipeBookSettings) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundRecipeBookSettings
|
||||
}
|
||||
func (RemoveEntities) PacketID() packetid.ClientboundPacketID {
|
||||
func (*RemoveEntities) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundRemoveEntities
|
||||
}
|
||||
func (RemoveMobEffect) PacketID() packetid.ClientboundPacketID {
|
||||
func (*RemoveMobEffect) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundRemoveMobEffect
|
||||
}
|
||||
func (ResetScore) PacketID() packetid.ClientboundPacketID {
|
||||
func (*ResetScore) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundResetScore
|
||||
}
|
||||
func (AddResourcePack) PacketID() packetid.ClientboundPacketID {
|
||||
func (*AddResourcePack) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundResourcePackPop
|
||||
}
|
||||
func (RemoveResourcePack) PacketID() packetid.ClientboundPacketID {
|
||||
func (*RemoveResourcePack) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundResourcePackPush
|
||||
}
|
||||
func (Respawn) PacketID() packetid.ClientboundPacketID {
|
||||
func (*Respawn) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundRespawn
|
||||
}
|
||||
func (SetHeadRotation) PacketID() packetid.ClientboundPacketID {
|
||||
func (*SetHeadRotation) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundRotateHead
|
||||
}
|
||||
func (UpdateSectionsBlocks) PacketID() packetid.ClientboundPacketID {
|
||||
func (*UpdateSectionsBlocks) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSectionBlocksUpdate
|
||||
}
|
||||
func (SelectAdvancementsTab) PacketID() packetid.ClientboundPacketID {
|
||||
func (*SelectAdvancementsTab) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSelectAdvancementsTab
|
||||
}
|
||||
func (ServerData) PacketID() packetid.ClientboundPacketID {
|
||||
func (*ServerData) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundServerData
|
||||
}
|
||||
func (SetActionBarText) PacketID() packetid.ClientboundPacketID {
|
||||
func (*SetActionBarText) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSetActionBarText
|
||||
}
|
||||
func (SetBorderCenter) PacketID() packetid.ClientboundPacketID {
|
||||
func (*SetBorderCenter) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSetBorderCenter
|
||||
}
|
||||
func (SetBorderLerpSize) PacketID() packetid.ClientboundPacketID {
|
||||
func (*SetBorderLerpSize) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSetBorderLerpSize
|
||||
}
|
||||
func (SetBorderSize) PacketID() packetid.ClientboundPacketID {
|
||||
func (*SetBorderSize) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSetBorderSize
|
||||
}
|
||||
func (SetBorderWarningDelay) PacketID() packetid.ClientboundPacketID {
|
||||
func (*SetBorderWarningDelay) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSetBorderWarningDelay
|
||||
}
|
||||
func (SetBorderWarningDistance) PacketID() packetid.ClientboundPacketID {
|
||||
func (*SetBorderWarningDistance) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSetBorderWarningDistance
|
||||
}
|
||||
func (SetCamera) PacketID() packetid.ClientboundPacketID {
|
||||
func (*SetCamera) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSetCamera
|
||||
}
|
||||
func (SetCenterChunk) PacketID() packetid.ClientboundPacketID {
|
||||
func (*SetCenterChunk) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSetChunkCacheCenter
|
||||
}
|
||||
func (SetRenderDistance) PacketID() packetid.ClientboundPacketID {
|
||||
func (*SetRenderDistance) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSetChunkCacheRadius
|
||||
}
|
||||
func (SetCursorItem) PacketID() packetid.ClientboundPacketID {
|
||||
func (*SetCursorItem) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSetCursorItem
|
||||
}
|
||||
func (SetDefaultSpawnPosition) PacketID() packetid.ClientboundPacketID {
|
||||
func (*SetDefaultSpawnPosition) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSetDefaultSpawnPosition
|
||||
}
|
||||
func (DisplayObjective) PacketID() packetid.ClientboundPacketID {
|
||||
func (*DisplayObjective) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSetDisplayObjective
|
||||
}
|
||||
func (SetEntityMetadata) PacketID() packetid.ClientboundPacketID {
|
||||
func (*SetEntityMetadata) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSetEntityData
|
||||
}
|
||||
func (SetEntityLink) PacketID() packetid.ClientboundPacketID {
|
||||
func (*SetEntityLink) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSetEntityLink
|
||||
}
|
||||
func (SetEntityVelocity) PacketID() packetid.ClientboundPacketID {
|
||||
func (*SetEntityVelocity) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSetEntityMotion
|
||||
}
|
||||
func (SetEquipment) PacketID() packetid.ClientboundPacketID {
|
||||
func (*SetEquipment) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSetEquipment
|
||||
}
|
||||
func (SetExperience) PacketID() packetid.ClientboundPacketID {
|
||||
func (*SetExperience) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSetExperience
|
||||
}
|
||||
func (SetHealth) PacketID() packetid.ClientboundPacketID {
|
||||
func (*SetHealth) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSetHealth
|
||||
}
|
||||
func (SetHeldItem) PacketID() packetid.ClientboundPacketID {
|
||||
func (*SetHeldItem) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSetHeldSlot
|
||||
}
|
||||
func (UpdateObjectives) PacketID() packetid.ClientboundPacketID {
|
||||
func (*UpdateObjectives) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSetObjective
|
||||
}
|
||||
func (SetPassengers) PacketID() packetid.ClientboundPacketID {
|
||||
func (*SetPassengers) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSetPassengers
|
||||
}
|
||||
func (SetPlayerInventory) PacketID() packetid.ClientboundPacketID {
|
||||
func (*SetPlayerInventory) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSetPlayerInventory
|
||||
}
|
||||
func (UpdateTeams) PacketID() packetid.ClientboundPacketID {
|
||||
func (*UpdateTeams) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSetPlayerTeam
|
||||
}
|
||||
func (UpdateScore) PacketID() packetid.ClientboundPacketID {
|
||||
func (*UpdateScore) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSetScore
|
||||
}
|
||||
func (SetSimulationDistance) PacketID() packetid.ClientboundPacketID {
|
||||
func (*SetSimulationDistance) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSetSimulationDistance
|
||||
}
|
||||
func (SetSubtitleText) PacketID() packetid.ClientboundPacketID {
|
||||
func (*SetSubtitleText) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSetSubtitleText
|
||||
}
|
||||
func (SetTime) PacketID() packetid.ClientboundPacketID {
|
||||
func (*SetTime) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSetTime
|
||||
}
|
||||
func (SetTitleText) PacketID() packetid.ClientboundPacketID {
|
||||
func (*SetTitleText) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSetTitleText
|
||||
}
|
||||
func (SetTitleAnimationTimes) PacketID() packetid.ClientboundPacketID {
|
||||
func (*SetTitleAnimationTimes) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSetTitlesAnimation
|
||||
}
|
||||
func (EntitySoundEffect) PacketID() packetid.ClientboundPacketID {
|
||||
func (*EntitySoundEffect) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSoundEntity
|
||||
}
|
||||
func (SoundEffect) PacketID() packetid.ClientboundPacketID {
|
||||
func (*SoundEffect) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSound
|
||||
}
|
||||
func (StartConfiguration) PacketID() packetid.ClientboundPacketID {
|
||||
func (*StartConfiguration) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundStartConfiguration
|
||||
}
|
||||
func (StopSound) PacketID() packetid.ClientboundPacketID {
|
||||
func (*StopSound) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundStopSound
|
||||
}
|
||||
func (StoreCookie) PacketID() packetid.ClientboundPacketID {
|
||||
func (*StoreCookie) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundStoreCookie
|
||||
}
|
||||
func (SystemChatMessage) PacketID() packetid.ClientboundPacketID {
|
||||
func (*SystemChatMessage) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundSystemChat
|
||||
}
|
||||
func (SetTabListHeaderAndFooter) PacketID() packetid.ClientboundPacketID {
|
||||
func (*SetTabListHeaderAndFooter) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundTabList
|
||||
}
|
||||
func (TagQueryResponse) PacketID() packetid.ClientboundPacketID {
|
||||
func (*TagQueryResponse) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundTagQuery
|
||||
}
|
||||
func (PickupItem) PacketID() packetid.ClientboundPacketID {
|
||||
func (*PickupItem) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundTakeItemEntity
|
||||
}
|
||||
func (SynchronizeVehiclePosition) PacketID() packetid.ClientboundPacketID {
|
||||
func (*SynchronizeVehiclePosition) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundTeleportEntity
|
||||
}
|
||||
func (TestInstanceBlockStatus) PacketID() packetid.ClientboundPacketID {
|
||||
func (*TestInstanceBlockStatus) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundTestInstanceBlockStatus
|
||||
}
|
||||
func (SetTickingState) PacketID() packetid.ClientboundPacketID {
|
||||
func (*SetTickingState) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundTickingState
|
||||
}
|
||||
func (StepTick) PacketID() packetid.ClientboundPacketID {
|
||||
func (*StepTick) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundTickingStep
|
||||
}
|
||||
func (Transfer) PacketID() packetid.ClientboundPacketID {
|
||||
func (*Transfer) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundTransfer
|
||||
}
|
||||
func (UpdateAdvancements) PacketID() packetid.ClientboundPacketID {
|
||||
func (*UpdateAdvancements) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundUpdateAdvancements
|
||||
}
|
||||
func (UpdateAttributes) PacketID() packetid.ClientboundPacketID {
|
||||
func (*UpdateAttributes) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundUpdateAttributes
|
||||
}
|
||||
func (EntityEffect) PacketID() packetid.ClientboundPacketID {
|
||||
func (*EntityEffect) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundUpdateMobEffect
|
||||
}
|
||||
func (UpdateRecipes) PacketID() packetid.ClientboundPacketID {
|
||||
func (*UpdateRecipes) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundUpdateRecipes
|
||||
}
|
||||
func (UpdateTags) PacketID() packetid.ClientboundPacketID {
|
||||
func (*UpdateTags) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundUpdateTags
|
||||
}
|
||||
func (ProjectilePower) PacketID() packetid.ClientboundPacketID {
|
||||
func (*ProjectilePower) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundProjectilePower
|
||||
}
|
||||
func (CustomReportDetails) PacketID() packetid.ClientboundPacketID {
|
||||
func (*CustomReportDetails) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundCustomReportDetails
|
||||
}
|
||||
func (ServerLinks) PacketID() packetid.ClientboundPacketID {
|
||||
func (*ServerLinks) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundServerLinks
|
||||
}
|
||||
func (Waypoint) PacketID() packetid.ClientboundPacketID {
|
||||
func (*Waypoint) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundWaypoint
|
||||
}
|
||||
func (ClearDialog) PacketID() packetid.ClientboundPacketID {
|
||||
func (*ClearDialog) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundClearDialog
|
||||
}
|
||||
func (ShowDialog) PacketID() packetid.ClientboundPacketID {
|
||||
func (*ShowDialog) PacketID() packetid.ClientboundPacketID {
|
||||
return packetid.ClientboundShowDialog
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ func (p PlayerInfoUpdate) WriteTo(w io.Writer) (n int64, err error) {
|
||||
}
|
||||
|
||||
func (p *PlayerInfoUpdate) ReadFrom(r io.Reader) (n int64, err error) {
|
||||
bitset := pk.NewFixedBitSet(8)
|
||||
bitset := pk.NewFixedBitSet(256)
|
||||
n1, err := bitset.ReadFrom(r)
|
||||
if err != nil {
|
||||
return n1, err
|
||||
|
@ -7,7 +7,7 @@ type AcceptTeleportation struct {
|
||||
TeleportID int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (AcceptTeleportation) PacketID() packetid.ServerboundPacketID {
|
||||
func (*AcceptTeleportation) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundAcceptTeleportation
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ type BlockEntityTagQuery struct {
|
||||
Location pk.Position
|
||||
}
|
||||
|
||||
func (BlockEntityTagQuery) PacketID() packetid.ServerboundPacketID {
|
||||
func (*BlockEntityTagQuery) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundBlockEntityTagQuery
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ type BundleItemSelected struct {
|
||||
SlotInBundle int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (BundleItemSelected) PacketID() packetid.ServerboundPacketID {
|
||||
func (*BundleItemSelected) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundBundleItemSelected
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ type ChangeDifficulty struct {
|
||||
Difficulty uint8
|
||||
}
|
||||
|
||||
func (ChangeDifficulty) PacketID() packetid.ServerboundPacketID {
|
||||
func (*ChangeDifficulty) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundChangeDifficulty
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ type ChangeGameMode struct {
|
||||
GameMode int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (ChangeGameMode) PacketID() packetid.ServerboundPacketID {
|
||||
func (*ChangeGameMode) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundChangeGameMode
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ type Chat struct {
|
||||
Checksum int8
|
||||
}
|
||||
|
||||
func (Chat) PacketID() packetid.ServerboundPacketID {
|
||||
func (*Chat) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundChat
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ type ChatAck struct {
|
||||
MessageCount int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (ChatAck) PacketID() packetid.ServerboundPacketID {
|
||||
func (*ChatAck) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundChatAck
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ type ChatCommand struct {
|
||||
Command string
|
||||
}
|
||||
|
||||
func (ChatCommand) PacketID() packetid.ServerboundPacketID {
|
||||
func (*ChatCommand) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundChatCommand
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ type ChatCommandSigned struct {
|
||||
Checksum int8
|
||||
}
|
||||
|
||||
func (ChatCommandSigned) PacketID() packetid.ServerboundPacketID {
|
||||
func (*ChatCommandSigned) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundChatCommandSigned
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ type ChatSessionUpdate struct {
|
||||
PublicKey user.PublicKey
|
||||
}
|
||||
|
||||
func (ChatSessionUpdate) PacketID() packetid.ServerboundPacketID {
|
||||
func (*ChatSessionUpdate) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundChatSessionUpdate
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ type ChunkBatchReceived struct {
|
||||
ChunksPerTick float32
|
||||
}
|
||||
|
||||
func (ChunkBatchReceived) PacketID() packetid.ServerboundPacketID {
|
||||
func (*ChunkBatchReceived) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundChunkBatchReceived
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ type ClientCommand struct {
|
||||
Action int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (ClientCommand) PacketID() packetid.ServerboundPacketID {
|
||||
func (*ClientCommand) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundClientCommand
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ type ClientInformation struct {
|
||||
ParticleStatus int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (ClientInformation) PacketID() packetid.ServerboundPacketID {
|
||||
func (*ClientInformation) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundClientInformation
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ import "github.com/Tnze/go-mc/data/packetid"
|
||||
type ClientTickEnd struct {
|
||||
}
|
||||
|
||||
func (ClientTickEnd) PacketID() packetid.ServerboundPacketID {
|
||||
func (*ClientTickEnd) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundClientTickEnd
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ type CommandSuggestion struct {
|
||||
Text string
|
||||
}
|
||||
|
||||
func (CommandSuggestion) PacketID() packetid.ServerboundPacketID {
|
||||
func (*CommandSuggestion) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundCommandSuggestion
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ import "github.com/Tnze/go-mc/data/packetid"
|
||||
type ConfigurationAcknowledged struct {
|
||||
}
|
||||
|
||||
func (ConfigurationAcknowledged) PacketID() packetid.ServerboundPacketID {
|
||||
func (*ConfigurationAcknowledged) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundConfigurationAcknowledged
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ type ContainerButtonClick struct {
|
||||
ButtonID int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (ContainerButtonClick) PacketID() packetid.ServerboundPacketID {
|
||||
func (*ContainerButtonClick) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundContainerButtonClick
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ type ContainerClick struct {
|
||||
CarriedSlot slot.HashedSlot
|
||||
}
|
||||
|
||||
func (ContainerClick) PacketID() packetid.ServerboundPacketID {
|
||||
func (*ContainerClick) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundContainerClick
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ type ContainerClose struct {
|
||||
WindowID int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (ContainerClose) PacketID() packetid.ServerboundPacketID {
|
||||
func (*ContainerClose) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundContainerClose
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ type ContainerSlotStateChanged struct {
|
||||
State bool
|
||||
}
|
||||
|
||||
func (ContainerSlotStateChanged) PacketID() packetid.ServerboundPacketID {
|
||||
func (*ContainerSlotStateChanged) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundContainerSlotStateChanged
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ type CookieResponse struct {
|
||||
Payload []int8 `mc:"Byte"`
|
||||
}
|
||||
|
||||
func (CookieResponse) PacketID() packetid.ServerboundPacketID {
|
||||
func (*CookieResponse) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundCookieResponse
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ type CustomClickAction struct {
|
||||
Payload nbt.RawMessage `mc:"NBT"`
|
||||
}
|
||||
|
||||
func (CustomClickAction) PacketID() packetid.ServerboundPacketID {
|
||||
func (*CustomClickAction) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundCustomClickAction
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ type CustomPayload struct {
|
||||
Data []byte `mc:"ByteArray"`
|
||||
}
|
||||
|
||||
func (CustomPayload) PacketID() packetid.ServerboundPacketID {
|
||||
func (*CustomPayload) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundCustomPayload
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ type DebugSampleSubscription struct {
|
||||
SampleType int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (DebugSampleSubscription) PacketID() packetid.ServerboundPacketID {
|
||||
func (*DebugSampleSubscription) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundDebugSampleSubscription
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ type EditBook struct {
|
||||
Title string
|
||||
}
|
||||
|
||||
func (EditBook) PacketID() packetid.ServerboundPacketID {
|
||||
func (*EditBook) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundEditBook
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ type EntityTagQuery struct {
|
||||
EntityID int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (EntityTagQuery) PacketID() packetid.ServerboundPacketID {
|
||||
func (*EntityTagQuery) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundEntityTagQuery
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ type Interact struct {
|
||||
SneakKeyPressed bool
|
||||
}
|
||||
|
||||
func (Interact) PacketID() packetid.ServerboundPacketID {
|
||||
func (*Interact) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundInteract
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ type JigsawGenerate struct {
|
||||
KeepJigsaws bool
|
||||
}
|
||||
|
||||
func (JigsawGenerate) PacketID() packetid.ServerboundPacketID {
|
||||
func (*JigsawGenerate) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundJigsawGenerate
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ type KeepAlive struct {
|
||||
ID int64
|
||||
}
|
||||
|
||||
func (KeepAlive) PacketID() packetid.ServerboundPacketID {
|
||||
func (*KeepAlive) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundKeepAlive
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ type LockDifficulty struct {
|
||||
Locked bool
|
||||
}
|
||||
|
||||
func (LockDifficulty) PacketID() packetid.ServerboundPacketID {
|
||||
func (*LockDifficulty) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundLockDifficulty
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ type MovePlayerPos struct {
|
||||
Flags int8
|
||||
}
|
||||
|
||||
func (MovePlayerPos) PacketID() packetid.ServerboundPacketID {
|
||||
func (*MovePlayerPos) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundMovePlayerPos
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ type MovePlayerPosRot struct {
|
||||
Flags int8
|
||||
}
|
||||
|
||||
func (MovePlayerPosRot) PacketID() packetid.ServerboundPacketID {
|
||||
func (*MovePlayerPosRot) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundMovePlayerPosRot
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ type MovePlayerRot struct {
|
||||
Flags int8
|
||||
}
|
||||
|
||||
func (MovePlayerRot) PacketID() packetid.ServerboundPacketID {
|
||||
func (*MovePlayerRot) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundMovePlayerRot
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ type MovePlayerStatusOnly struct {
|
||||
Flags int8
|
||||
}
|
||||
|
||||
func (MovePlayerStatusOnly) PacketID() packetid.ServerboundPacketID {
|
||||
func (*MovePlayerStatusOnly) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundMovePlayerStatusOnly
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ type MoveVehicle struct {
|
||||
OnGround bool
|
||||
}
|
||||
|
||||
func (MoveVehicle) PacketID() packetid.ServerboundPacketID {
|
||||
func (*MoveVehicle) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundMoveVehicle
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ type PaddleBoat struct {
|
||||
LeftTurning, RightTurning bool
|
||||
}
|
||||
|
||||
func (PaddleBoat) PacketID() packetid.ServerboundPacketID {
|
||||
func (*PaddleBoat) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundPaddleBoat
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ type PickItemFromBlock struct {
|
||||
IncludeData bool
|
||||
}
|
||||
|
||||
func (PickItemFromBlock) PacketID() packetid.ServerboundPacketID {
|
||||
func (*PickItemFromBlock) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundPickItemFromBlock
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ type PickItemFromEntity struct {
|
||||
IncludeData bool
|
||||
}
|
||||
|
||||
func (PickItemFromEntity) PacketID() packetid.ServerboundPacketID {
|
||||
func (*PickItemFromEntity) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundPickItemFromEntity
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ type PingRequest struct {
|
||||
payload int64
|
||||
}
|
||||
|
||||
func (PingRequest) PacketID() packetid.ServerboundPacketID {
|
||||
func (*PingRequest) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundPingRequest
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ type PlaceRecipe struct {
|
||||
MakeAll bool
|
||||
}
|
||||
|
||||
func (PlaceRecipe) PacketID() packetid.ServerboundPacketID {
|
||||
func (*PlaceRecipe) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundPlaceRecipe
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ type PlayerAbilities struct {
|
||||
Flags int8
|
||||
}
|
||||
|
||||
func (PlayerAbilities) PacketID() packetid.ServerboundPacketID {
|
||||
func (*PlayerAbilities) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundPlayerAbilities
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ type PlayerAction struct {
|
||||
Sequence int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (PlayerAction) PacketID() packetid.ServerboundPacketID {
|
||||
func (*PlayerAction) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundPlayerAction
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ type PlayerCommand struct {
|
||||
JumpBoost int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (PlayerCommand) PacketID() packetid.ServerboundPacketID {
|
||||
func (*PlayerCommand) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundPlayerCommand
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ type PlayerInput struct {
|
||||
Flags uint8
|
||||
}
|
||||
|
||||
func (PlayerInput) PacketID() packetid.ServerboundPacketID {
|
||||
func (*PlayerInput) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundPlayerInput
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ import "github.com/Tnze/go-mc/data/packetid"
|
||||
type PlayerLoaded struct {
|
||||
}
|
||||
|
||||
func (PlayerLoaded) PacketID() packetid.ServerboundPacketID {
|
||||
func (*PlayerLoaded) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundPlayerLoaded
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ import "github.com/Tnze/go-mc/data/packetid"
|
||||
type Pong struct {
|
||||
}
|
||||
|
||||
func (Pong) PacketID() packetid.ServerboundPacketID {
|
||||
func (*Pong) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundPong
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ type RecipeBookChangeSettings struct {
|
||||
FilterActive bool
|
||||
}
|
||||
|
||||
func (RecipeBookChangeSettings) PacketID() packetid.ServerboundPacketID {
|
||||
func (*RecipeBookChangeSettings) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundRecipeBookChangeSettings
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ type RecipeBookSeenRecipe struct {
|
||||
RecipeID int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (RecipeBookSeenRecipe) PacketID() packetid.ServerboundPacketID {
|
||||
func (*RecipeBookSeenRecipe) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundRecipeBookSeenRecipe
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ type RenameItem struct {
|
||||
ItemName string
|
||||
}
|
||||
|
||||
func (RenameItem) PacketID() packetid.ServerboundPacketID {
|
||||
func (*RenameItem) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundRenameItem
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ type ResourcePack struct {
|
||||
Result int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (ResourcePack) PacketID() packetid.ServerboundPacketID {
|
||||
func (*ResourcePack) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundResourcePack
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ type SeenAdvancements struct {
|
||||
TabID string `mc:"Identifier"`
|
||||
}
|
||||
|
||||
func (SeenAdvancements) PacketID() packetid.ServerboundPacketID {
|
||||
func (*SeenAdvancements) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundSeenAdvancements
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ type SelectTrade struct {
|
||||
SelectedSlot int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (SelectTrade) PacketID() packetid.ServerboundPacketID {
|
||||
func (*SelectTrade) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundSelectTrade
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ type SetBeacon struct {
|
||||
SecondaryEffect int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (SetBeacon) PacketID() packetid.ServerboundPacketID {
|
||||
func (*SetBeacon) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundSetBeacon
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ type SetCarriedItem struct {
|
||||
Slot int16
|
||||
}
|
||||
|
||||
func (SetCarriedItem) PacketID() packetid.ServerboundPacketID {
|
||||
func (*SetCarriedItem) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundSetCarriedItem
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ type SetCommandBlock struct {
|
||||
Flags int8
|
||||
}
|
||||
|
||||
func (SetCommandBlock) PacketID() packetid.ServerboundPacketID {
|
||||
func (*SetCommandBlock) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundSetCommandBlock
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ type SetCommandMinecart struct {
|
||||
TrackOutput bool
|
||||
}
|
||||
|
||||
func (SetCommandMinecart) PacketID() packetid.ServerboundPacketID {
|
||||
func (*SetCommandMinecart) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundSetCommandMinecart
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ type SetCreativeModeSlot struct {
|
||||
ClickedItem slot.Slot
|
||||
}
|
||||
|
||||
func (SetCreativeModeSlot) PacketID() packetid.ServerboundPacketID {
|
||||
func (*SetCreativeModeSlot) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundSetCreativeModeSlot
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ type SetJigsawBlock struct {
|
||||
PlacementPriority int32 `mc:"VarInt"`
|
||||
}
|
||||
|
||||
func (SetJigsawBlock) PacketID() packetid.ServerboundPacketID {
|
||||
func (*SetJigsawBlock) PacketID() packetid.ServerboundPacketID {
|
||||
return packetid.ServerboundSetJigsawBlock
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user