Documentation ¶
Index ¶
- Constants
- Variables
- type ChatMessagePacket
- type ClientSettingsPacket
- func (c *ClientSettingsPacket) Direction() Direction
- func (c *ClientSettingsPacket) ID() int32
- func (c *ClientSettingsPacket) Read(r io.Reader) error
- func (c *ClientSettingsPacket) State() game.ConnectionState
- func (*ClientSettingsPacket) String() string
- func (c *ClientSettingsPacket) Write(w io.Writer) error
- type Direction
- type Encoding
- type HandshakePacket
- type Info
- type JoinGamePacket
- type LoginDisconnectPacket
- func (l *LoginDisconnectPacket) Direction() Direction
- func (l *LoginDisconnectPacket) ID() int32
- func (l *LoginDisconnectPacket) Read(r io.Reader) error
- func (l *LoginDisconnectPacket) State() game.ConnectionState
- func (*LoginDisconnectPacket) String() string
- func (l *LoginDisconnectPacket) Write(w io.Writer) error
- type LoginStartPacket
- func (l *LoginStartPacket) Direction() Direction
- func (l *LoginStartPacket) ID() int32
- func (*LoginStartPacket) Info() Info
- func (l *LoginStartPacket) Read(r io.Reader) error
- func (l *LoginStartPacket) State() game.ConnectionState
- func (*LoginStartPacket) String() string
- func (l *LoginStartPacket) Write(w io.Writer) error
- type LoginSuccessPacket
- type Packet
- type PingPacket
- type PlayerPositionLookPacket
- func (p *PlayerPositionLookPacket) Direction() Direction
- func (p *PlayerPositionLookPacket) ID() int32
- func (p *PlayerPositionLookPacket) Read(r io.Reader) error
- func (p *PlayerPositionLookPacket) State() game.ConnectionState
- func (*PlayerPositionLookPacket) String() string
- func (p *PlayerPositionLookPacket) Write(w io.Writer) error
- type PluginMessagePacket
- func (p *PluginMessagePacket) Direction() Direction
- func (p *PluginMessagePacket) ID() int32
- func (p *PluginMessagePacket) Read(r io.Reader) error
- func (p *PluginMessagePacket) State() game.ConnectionState
- func (*PluginMessagePacket) String() string
- func (p *PluginMessagePacket) Write(w io.Writer) error
- type PongPacket
- type ServerInfoPacket
- type ServerQueryPacket
Constants ¶
const ChatMessagePacketID = 0x0f
const ClientSettingsPacketID int32 = 0x05
const HandshakePacketID int32 = 0x00
const JoinGamePacketID int32 = 0x26
const LoginDisconnectPacketID int32 = 0x00
const LoginStartPacketID int32 = 0x00
const LoginSuccessPacketID = 0x02
const MaxPacketLength = 1048576
const PingPacketID = 0x01
const PlayerPositionLookPacketID int32 = 0x36
const PluginMessagePacketID int32 = 0x19
const PongPacketID int32 = 0x01
const ServerInfoPacketID int32 = 0x00
const ServerQueryPacketID int32 = 0x00
Variables ¶
var (
ErrInvalidPacketLength = errors.New("packet has a malformed length")
)
Functions ¶
This section is empty.
Types ¶
type ChatMessagePacket ¶
type ChatMessagePacket struct { Message game.TextComponent Position enc.Byte }
ChatMessagePacket is sent by the server for incoming chat messages https://wiki.vg/Protocol?oldid=16067#Chat_Message_.28clientbound.29
func (*ChatMessagePacket) Direction ¶
func (c *ChatMessagePacket) Direction() Direction
func (*ChatMessagePacket) ID ¶
func (c *ChatMessagePacket) ID() int32
func (*ChatMessagePacket) State ¶
func (c *ChatMessagePacket) State() game.ConnectionState
func (*ChatMessagePacket) String ¶
func (c *ChatMessagePacket) String() string
type ClientSettingsPacket ¶
type ClientSettingsPacket struct { Lang enc.String ViewDistance enc.Byte ChatVisibility enc.VarInt EnableChatColors enc.Bool DisplayedSkinParts enc.UnsignedByte MainHand game.Hand }
ClientSettingsPacket is sent by the client to inform the server of the (updated) client settings https://wiki.vg/Protocol?oldid=16067#Client_Settings
func (*ClientSettingsPacket) Direction ¶
func (c *ClientSettingsPacket) Direction() Direction
func (*ClientSettingsPacket) ID ¶
func (c *ClientSettingsPacket) ID() int32
func (*ClientSettingsPacket) State ¶
func (c *ClientSettingsPacket) State() game.ConnectionState
func (*ClientSettingsPacket) String ¶
func (*ClientSettingsPacket) String() string
type HandshakePacket ¶
type HandshakePacket struct { ProtoVer enc.VarInt ServerAddr enc.String ServerPort enc.UnsignedShort NextState game.ConnectionState }
HandshakePacket is sent by the client to initiate a handshake by changing the connection state https://wiki.vg/Protocol?oldid=16067#Handshake
func (*HandshakePacket) Direction ¶
func (h *HandshakePacket) Direction() Direction
func (*HandshakePacket) ID ¶
func (h *HandshakePacket) ID() int32
func (*HandshakePacket) State ¶
func (h *HandshakePacket) State() game.ConnectionState
func (*HandshakePacket) String ¶
func (*HandshakePacket) String() string
type Info ¶
type Info struct { ID int32 Direction Direction ConnectionState game.ConnectionState }
Info is the info that uniquely identifies a packet
type JoinGamePacket ¶
type JoinGamePacket struct { PlayerID enc.Int GameMode game.Mode Dimension game.Dimension HashedSeed enc.Long MaxPlayers enc.UnsignedByte LevelType enc.String `len:"16"` ViewDistance enc.VarInt ReducedDebug enc.Bool EnableRespawnScreen enc.Bool }
JoinGamePacket is sent by the server to inform the client of various game & world parameters https://wiki.vg/Protocol?oldid=16067#Join_Game
func (*JoinGamePacket) Direction ¶
func (j *JoinGamePacket) Direction() Direction
func (*JoinGamePacket) ID ¶
func (j *JoinGamePacket) ID() int32
func (*JoinGamePacket) State ¶
func (j *JoinGamePacket) State() game.ConnectionState
func (*JoinGamePacket) String ¶
func (*JoinGamePacket) String() string
type LoginDisconnectPacket ¶
type LoginDisconnectPacket struct {
Reason game.TextComponent
}
LoginDisconnectPacket is sent by the server when the user is disconnected while they are logging in (e.g. banned) https://wiki.vg/Protocol?oldid=16067#Disconnect_.28login.29
func (*LoginDisconnectPacket) Direction ¶
func (l *LoginDisconnectPacket) Direction() Direction
func (*LoginDisconnectPacket) ID ¶
func (l *LoginDisconnectPacket) ID() int32
func (*LoginDisconnectPacket) State ¶
func (l *LoginDisconnectPacket) State() game.ConnectionState
func (*LoginDisconnectPacket) String ¶
func (*LoginDisconnectPacket) String() string
type LoginStartPacket ¶
LoginStartPacket is sent by the client to start logging in https://wiki.vg/Protocol?oldid=16067#Login_Start
func (*LoginStartPacket) Direction ¶
func (l *LoginStartPacket) Direction() Direction
func (*LoginStartPacket) ID ¶
func (l *LoginStartPacket) ID() int32
func (*LoginStartPacket) Info ¶
func (*LoginStartPacket) Info() Info
func (*LoginStartPacket) State ¶
func (l *LoginStartPacket) State() game.ConnectionState
func (*LoginStartPacket) String ¶
func (*LoginStartPacket) String() string
type LoginSuccessPacket ¶
LoginSuccessPacket is sent by the server when the login was successful https://wiki.vg/Protocol?oldid=16067#Login_Success
func (*LoginSuccessPacket) Direction ¶
func (l *LoginSuccessPacket) Direction() Direction
func (*LoginSuccessPacket) ID ¶
func (l *LoginSuccessPacket) ID() int32
func (*LoginSuccessPacket) State ¶
func (l *LoginSuccessPacket) State() game.ConnectionState
func (*LoginSuccessPacket) String ¶
func (*LoginSuccessPacket) String() string
type Packet ¶
type Packet interface { fmt.Stringer Encoding ID() int32 Direction() Direction State() game.ConnectionState }
Packet is a packet with side-bound ID & direction that can be encoded and sent
type PingPacket ¶
PingPacket is sent by the client to get a PongPacket response. https://wiki.vg/Protocol?oldid=16067#Ping
func (*PingPacket) Direction ¶
func (p *PingPacket) Direction() Direction
func (*PingPacket) ID ¶
func (p *PingPacket) ID() int32
func (*PingPacket) State ¶
func (p *PingPacket) State() game.ConnectionState
func (*PingPacket) String ¶
func (*PingPacket) String() string
type PlayerPositionLookPacket ¶
type PlayerPositionLookPacket struct { X enc.Double Y enc.Double Z enc.Double Yaw enc.Float Pitch enc.Float Flags enc.Byte TeleportID enc.VarInt }
PlayerPositionLookPacket is sent by the server to inform the client of its location https://wiki.vg/Protocol?oldid=16067#Player_Position_And_Look_.28clientbound.29
func (*PlayerPositionLookPacket) Direction ¶
func (p *PlayerPositionLookPacket) Direction() Direction
func (*PlayerPositionLookPacket) ID ¶
func (p *PlayerPositionLookPacket) ID() int32
func (*PlayerPositionLookPacket) State ¶
func (p *PlayerPositionLookPacket) State() game.ConnectionState
func (*PlayerPositionLookPacket) String ¶
func (*PlayerPositionLookPacket) String() string
type PluginMessagePacket ¶
type PluginMessagePacket struct { Channel game.Identifier Data Encoding }
PluginMessagePacket is sent by the client as part of a plugin's message channel https://wiki.vg/Protocol?oldid=16067#Plugin_Message_.28clientbound.29
func (*PluginMessagePacket) Direction ¶
func (p *PluginMessagePacket) Direction() Direction
func (*PluginMessagePacket) ID ¶
func (p *PluginMessagePacket) ID() int32
func (*PluginMessagePacket) State ¶
func (p *PluginMessagePacket) State() game.ConnectionState
func (*PluginMessagePacket) String ¶
func (*PluginMessagePacket) String() string
type PongPacket ¶
PongPacket is sent by the server as a response to a PingPacket. https://wiki.vg/Protocol?oldid=16067#Pong
func (*PongPacket) Direction ¶
func (p *PongPacket) Direction() Direction
func (*PongPacket) ID ¶
func (p *PongPacket) ID() int32
func (*PongPacket) State ¶
func (p *PongPacket) State() game.ConnectionState
func (*PongPacket) String ¶
func (*PongPacket) String() string
type ServerInfoPacket ¶
type ServerInfoPacket struct {
Response game.ServerInfo
}
ServerInfoPacket is sent by the server as a response to a ServerQueryPacket. https://wiki.vg/Protocol?oldid=16067#Response
func (*ServerInfoPacket) Direction ¶
func (s *ServerInfoPacket) Direction() Direction
func (*ServerInfoPacket) ID ¶
func (s *ServerInfoPacket) ID() int32
func (*ServerInfoPacket) State ¶
func (s *ServerInfoPacket) State() game.ConnectionState
func (*ServerInfoPacket) String ¶
func (*ServerInfoPacket) String() string
type ServerQueryPacket ¶
type ServerQueryPacket struct{}
ServerQueryPacket is sent by the client to query the Minecraft server for protocol version, message of the day and online player information. https://wiki.vg/Protocol?oldid=16067#Request
func (ServerQueryPacket) Direction ¶
func (s ServerQueryPacket) Direction() Direction
func (ServerQueryPacket) ID ¶
func (s ServerQueryPacket) ID() int32
func (ServerQueryPacket) State ¶
func (s ServerQueryPacket) State() game.ConnectionState
func (*ServerQueryPacket) String ¶
func (*ServerQueryPacket) String() string
Source Files ¶
- chat.go
- chat_gen.go
- client_settings.go
- client_settings_gen.go
- direction.go
- direction_string.go
- handshake.go
- handshake_gen.go
- join_game.go
- join_game_gen.go
- login_disconnect.go
- login_disconnect_gen.go
- login_start.go
- login_start_gen.go
- login_success.go
- login_success_gen.go
- packet.go
- ping.go
- ping_gen.go
- player_position_look.go
- player_position_look_gen.go
- plugin_message.go
- plugin_message_gen.go
- pong.go
- pong_gen.go
- server_info.go
- server_info_gen.go
- server_query.go
- server_query_gen.go