packets

package
v0.0.0-...-a5a0d7e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2021 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(src protocol.Protocol, destinations ...protocol.Protocol)

func Get

func Get(proto protocol.Protocol, state protocol.State, direction protocol.Direction, id int32) (protocol.Packet, error)

func GetID

func GetID(proto protocol.Protocol, state protocol.State, direction protocol.Direction, packet protocol.Packet) (int32, error)

func Register

func Register(proto protocol.Protocol, packetsMap map[protocol.State]map[protocol.Direction]map[reflect.Type]int32) error

Types

type Description

type Description []chat.Component

func (Description) MarshalJSON

func (d Description) MarshalJSON() ([]byte, error)

func (*Description) UnmarshalJSON

func (d *Description) UnmarshalJSON(data []byte) error

type PacketHandshakingStart

type PacketHandshakingStart struct {
	ProtocolVersion int32
	ServerAddress   string
	ServerPort      uint16
	NextState       int32
}

func (*PacketHandshakingStart) GetID

func (packet *PacketHandshakingStart) GetID(proto protocol.Protocol) (int32, error)

func (*PacketHandshakingStart) Read

func (packet *PacketHandshakingStart) Read(_ protocol.Protocol, buffer *bytes.Buffer) error

func (*PacketHandshakingStart) Write

func (packet *PacketHandshakingStart) Write(_ protocol.Protocol, buffer *bytes.Buffer) error

type PacketLoginInStart

type PacketLoginInStart struct {
	Username string
}

func (*PacketLoginInStart) GetID

func (packet *PacketLoginInStart) GetID(proto protocol.Protocol) (int32, error)

func (*PacketLoginInStart) Read

func (packet *PacketLoginInStart) Read(_ protocol.Protocol, buffer *bytes.Buffer) error

func (*PacketLoginInStart) Write

func (packet *PacketLoginInStart) Write(_ protocol.Protocol, buffer *bytes.Buffer) error

type PacketLoginOutCompression

type PacketLoginOutCompression struct {
	Threshold int32
}

func (*PacketLoginOutCompression) GetID

func (packet *PacketLoginOutCompression) GetID(proto protocol.Protocol) (int32, error)

func (*PacketLoginOutCompression) Read

func (packet *PacketLoginOutCompression) Read(_ protocol.Protocol, buffer *bytes.Buffer) error

func (*PacketLoginOutCompression) Write

func (packet *PacketLoginOutCompression) Write(_ protocol.Protocol, buffer *bytes.Buffer) error

type PacketLoginOutDisconnect

type PacketLoginOutDisconnect struct {
	Reason []chat.Component
}

func (*PacketLoginOutDisconnect) GetID

func (packet *PacketLoginOutDisconnect) GetID(proto protocol.Protocol) (int32, error)

func (*PacketLoginOutDisconnect) Read

func (packet *PacketLoginOutDisconnect) Read(_ protocol.Protocol, buffer *bytes.Buffer) error

func (*PacketLoginOutDisconnect) Write

func (packet *PacketLoginOutDisconnect) Write(_ protocol.Protocol, buffer *bytes.Buffer) error

type PacketLoginOutSuccess

type PacketLoginOutSuccess struct {
	UniqueID uuid.UUID
	Username string
}

func (*PacketLoginOutSuccess) GetID

func (packet *PacketLoginOutSuccess) GetID(proto protocol.Protocol) (int32, error)

func (*PacketLoginOutSuccess) Read

func (packet *PacketLoginOutSuccess) Read(proto protocol.Protocol, buffer *bytes.Buffer) error

func (*PacketLoginOutSuccess) Write

func (packet *PacketLoginOutSuccess) Write(proto protocol.Protocol, buffer *bytes.Buffer) error

type PacketPlayInChatMessage

type PacketPlayInChatMessage struct {
	Message string
}

func (*PacketPlayInChatMessage) GetID

func (packet *PacketPlayInChatMessage) GetID(proto protocol.Protocol) (int32, error)

func (*PacketPlayInChatMessage) Read

func (packet *PacketPlayInChatMessage) Read(_ protocol.Protocol, buffer *bytes.Buffer) error

func (*PacketPlayInChatMessage) Write

func (packet *PacketPlayInChatMessage) Write(_ protocol.Protocol, buffer *bytes.Buffer) error

type PacketPlayInKeepAlive

type PacketPlayInKeepAlive struct {
	KeepAliveID int32
}

func (*PacketPlayInKeepAlive) GetID

func (packet *PacketPlayInKeepAlive) GetID(proto protocol.Protocol) (int32, error)

func (*PacketPlayInKeepAlive) Read

func (packet *PacketPlayInKeepAlive) Read(proto protocol.Protocol, buffer *bytes.Buffer) error

func (*PacketPlayInKeepAlive) Write

func (packet *PacketPlayInKeepAlive) Write(proto protocol.Protocol, buffer *bytes.Buffer) error

type PacketPlayOutChatMessage

type PacketPlayOutChatMessage struct {
	Message  []chat.Component
	Position int8
	Sender   uuid.UUID
}

func (*PacketPlayOutChatMessage) GetID

func (packet *PacketPlayOutChatMessage) GetID(proto protocol.Protocol) (int32, error)

func (*PacketPlayOutChatMessage) Read

func (packet *PacketPlayOutChatMessage) Read(proto protocol.Protocol, buffer *bytes.Buffer) error

func (*PacketPlayOutChatMessage) Write

func (packet *PacketPlayOutChatMessage) Write(proto protocol.Protocol, buffer *bytes.Buffer) error

type PacketPlayOutChunkData

type PacketPlayOutChunkData struct {
	ChunkX, ChunkZ int32
	FullChunk      bool
	PrimaryBit     int32
	Heightmaps     nbt.Tag
	Biomes         []int32
	Data           []byte
	BlockEntities  []nbt.Tag
}

func (*PacketPlayOutChunkData) GetID

func (packet *PacketPlayOutChunkData) GetID(proto protocol.Protocol) (int32, error)

func (*PacketPlayOutChunkData) Read

func (packet *PacketPlayOutChunkData) Read(_ protocol.Protocol, buffer *bytes.Buffer) error

func (*PacketPlayOutChunkData) Write

func (packet *PacketPlayOutChunkData) Write(_ protocol.Protocol, buffer *bytes.Buffer) error

type PacketPlayOutDisconnect

type PacketPlayOutDisconnect struct {
	Reason []chat.Component
}

func (*PacketPlayOutDisconnect) GetID

func (packet *PacketPlayOutDisconnect) GetID(proto protocol.Protocol) (int32, error)

func (*PacketPlayOutDisconnect) Read

func (packet *PacketPlayOutDisconnect) Read(_ protocol.Protocol, buffer *bytes.Buffer) error

func (*PacketPlayOutDisconnect) Write

func (packet *PacketPlayOutDisconnect) Write(_ protocol.Protocol, buffer *bytes.Buffer) error

type PacketPlayOutJoinGame

type PacketPlayOutJoinGame struct {
	EntityID         int32
	Hardcore         bool
	Gamemode         uint8
	PreviousGamemode int8
	WorldNames       []string
	DimensionCodec   protocol.DimensionCodec
	Dimension        protocol.Dimension
	WorldName        string
	DimensionID      int8
	Difficulty       uint8
	HashedSeed       int64
	MaxPlayers       int32
	LevelType        string
	ViewDistance     int32
	ReducedDebug     bool
	RespawnScreen    bool
	IsDebug          bool
	IsFlat           bool
}

func (*PacketPlayOutJoinGame) GetID

func (packet *PacketPlayOutJoinGame) GetID(proto protocol.Protocol) (int32, error)

func (*PacketPlayOutJoinGame) Read

func (packet *PacketPlayOutJoinGame) Read(proto protocol.Protocol, buffer *bytes.Buffer) error

func (*PacketPlayOutJoinGame) Write

func (packet *PacketPlayOutJoinGame) Write(proto protocol.Protocol, buffer *bytes.Buffer) error

type PacketPlayOutKeepAlive

type PacketPlayOutKeepAlive struct {
	KeepAliveID int32
}

func (*PacketPlayOutKeepAlive) GetID

func (packet *PacketPlayOutKeepAlive) GetID(proto protocol.Protocol) (int32, error)

func (*PacketPlayOutKeepAlive) Read

func (packet *PacketPlayOutKeepAlive) Read(proto protocol.Protocol, buffer *bytes.Buffer) error

func (*PacketPlayOutKeepAlive) Write

func (packet *PacketPlayOutKeepAlive) Write(proto protocol.Protocol, buffer *bytes.Buffer) error

type PacketPlayOutPositionAndLook

type PacketPlayOutPositionAndLook struct {
	X, Y, Z    float64
	Yaw, Pitch float32
	Flags      uint8
	TeleportID int32
}

func (*PacketPlayOutPositionAndLook) GetID

func (packet *PacketPlayOutPositionAndLook) GetID(proto protocol.Protocol) (int32, error)

func (*PacketPlayOutPositionAndLook) Read

func (packet *PacketPlayOutPositionAndLook) Read(proto protocol.Protocol, buffer *bytes.Buffer) error

func (*PacketPlayOutPositionAndLook) Write

func (packet *PacketPlayOutPositionAndLook) Write(proto protocol.Protocol, buffer *bytes.Buffer) error

type PacketPlayOutServerDifficulty

type PacketPlayOutServerDifficulty struct {
	Difficulty uint8
	Locked     bool
}

func (*PacketPlayOutServerDifficulty) GetID

func (packet *PacketPlayOutServerDifficulty) GetID(proto protocol.Protocol) (int32, error)

func (*PacketPlayOutServerDifficulty) Read

func (packet *PacketPlayOutServerDifficulty) Read(proto protocol.Protocol, buffer *bytes.Buffer) error

func (*PacketPlayOutServerDifficulty) Write

func (packet *PacketPlayOutServerDifficulty) Write(proto protocol.Protocol, buffer *bytes.Buffer) error

type PacketStatusInPing

type PacketStatusInPing struct {
	Payload int64
}

func (*PacketStatusInPing) GetID

func (packet *PacketStatusInPing) GetID(proto protocol.Protocol) (int32, error)

func (*PacketStatusInPing) Read

func (packet *PacketStatusInPing) Read(_ protocol.Protocol, buffer *bytes.Buffer) error

func (*PacketStatusInPing) Write

func (packet *PacketStatusInPing) Write(_ protocol.Protocol, buffer *bytes.Buffer) error

type PacketStatusInRequest

type PacketStatusInRequest struct{}

func (*PacketStatusInRequest) GetID

func (packet *PacketStatusInRequest) GetID(proto protocol.Protocol) (int32, error)

func (*PacketStatusInRequest) Read

func (*PacketStatusInRequest) Write

type PacketStatusOutPong

type PacketStatusOutPong struct {
	Payload int64
}

func (*PacketStatusOutPong) GetID

func (packet *PacketStatusOutPong) GetID(proto protocol.Protocol) (int32, error)

func (*PacketStatusOutPong) Read

func (packet *PacketStatusOutPong) Read(_ protocol.Protocol, buffer *bytes.Buffer) error

func (*PacketStatusOutPong) Write

func (packet *PacketStatusOutPong) Write(_ protocol.Protocol, buffer *bytes.Buffer) error

type PacketStatusOutResponse

type PacketStatusOutResponse struct {
	Response Response
}

func (*PacketStatusOutResponse) GetID

func (packet *PacketStatusOutResponse) GetID(proto protocol.Protocol) (int32, error)

func (*PacketStatusOutResponse) Read

func (packet *PacketStatusOutResponse) Read(_ protocol.Protocol, buffer *bytes.Buffer) error

func (*PacketStatusOutResponse) Write

func (packet *PacketStatusOutResponse) Write(_ protocol.Protocol, buffer *bytes.Buffer) error

type Players

type Players struct {
	Max    int      `json:"max"`
	Online int      `json:"online"`
	Sample []Sample `json:"sample"`
}

type Response

type Response struct {
	Version     Version     `json:"version"`
	Players     Players     `json:"players"`
	Description Description `json:"description"`
}

type Sample

type Sample struct {
	Name string    `json:"name"`
	Id   uuid.UUID `json:"id"`
}

type Version

type Version struct {
	Name     string `json:"name"`
	Protocol int    `json:"protocol"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL