Documentation
¶
Index ¶
- Constants
- func WrongPacketError(expect, get int32) error
- type Angle
- type Boolean
- type Byte
- type ByteArray
- type Chat
- type Double
- type EncryptionRequest
- type EncryptionResponse
- type EntityMetadata
- type Float
- type Handshake
- type Identifier
- type Int
- type LegacyServerListPing
- type LoginDisconnect
- type LoginPluginRequest
- type LoginPluginResponse
- type LoginStart
- type LoginSuccess
- type Long
- type NBTTag
- type Packet
- type Ping
- type Pong
- type Position
- type RawPacket
- type Request
- type Response
- type SetCompression
- type Short
- type Slot
- type String
- type Type
- type UUID
- type UnsignedByte
- type UnsignedShort
- type VarInt
- type VarLong
Constants ¶
const EncryptionRequest_ID = 0x01
EncrpytionRequest_ID is the EncryptionRequest packet ID.
const EncryptionResponse_ID = 0x01
EncrpytionResponse_ID is the EncryptionResponse packet ID.
const Handshake_ID = 0x00
Handshake_ID is the Handshake packet ID.
const LegacyServerListPing_ID = 0xFE
LegacyServerListPing_ID is the LegacyServerListPing packet ID.
const LoginDisconnect_ID = 0x00
LoginDisconnect_ID is the LoginDisconnect packet ID.
const LoginPluginRequest_ID = 0x04
LoginPluginResponse_ID is the LoginPluginResponse packet ID.
const LoginPluginResponse_ID = 0x04
LoginPluginResponse_ID is the LoginPluginResponse packet ID.
const LoginStart_ID = 0x00
LoginStart_ID is the LoginStart packet ID.
const LoginSuccess_ID = 0x02
LoginSuccess_ID is the LoginSuccess packet ID.
const MaxVarIntLen = 5
MaxVarIntLen is Maximum VarInt length.
const MaxVarLongLen = 10
MaxVarLongLen is Maximum VarLong length.
const Ping_ID = 0x01
Ping_ID is the Ping packet ID.
const Pong_ID = 0x01
Pong_ID is the Pong packet ID.
const Request_ID = 0x00
Request_ID is the Request packet ID.
const Response_ID = 0x00
Response_ID is the Response packet ID.
const SetCompression_ID = 0x03
SetCompression_ID is the SetCompression packet ID.
Variables ¶
This section is empty.
Functions ¶
func WrongPacketError ¶
Types ¶
type Angle ¶
type Angle Byte
Angle is rotation angle in steps of 1/256 of a full turn. Implements proto.Type interface (Minecraft protocol data type).
type Boolean ¶
type Boolean bool
Boolean is either false or true. Implements proto.Type interface (Minecraft protocol data type).
type Byte ¶
type Byte int8
Byte is a signed 8-bit integer, two's complement. Implements proto.Type interface (Minecraft protocol data type).
type ByteArray ¶
type ByteArray []byte
ByteArray is just a sequence of zero or more bytes. Its meaning should be explained somewhere else (e.g. in the packet description). Implements proto.Type interface (Minecraft protocol data type).
type Chat ¶
type Chat = String
Chat supports two-way chat communication. Implements proto.Type interface (Minecraft protocol data type).
type Double ¶
type Double float64
Double is a double-precision 64-bit IEEE 754 floating point number. Implements proto.Type interface (Minecraft protocol data type).
type EncryptionRequest ¶
type EncryptionRequest struct { ServerID String PublicKeyLength VarInt PublicKey ByteArray VerifyTokenLength VarInt VerifyToken ByteArray }
EncryptionRequest is a packet that initiate encryption process. Clientbound (S -> C) Implements proto.Packet interface.
func (*EncryptionRequest) FromRaw ¶
func (pi *EncryptionRequest) FromRaw(p *RawPacket) (err error)
FromRaw unmarshals the EncryptionRequest Packet from the given RawPacket.
func (*EncryptionRequest) ToRaw ¶
func (pi *EncryptionRequest) ToRaw(p *RawPacket) (err error)
ToRaw marshals the EncryptionRequest Packet to the given RawPacket.
type EncryptionResponse ¶
EncryptionResponse is a packet sent by server to confirm the encryption process. Serverbound (C -> S) Implements proto.Packet interface.
func (*EncryptionResponse) FromRaw ¶
func (pi *EncryptionResponse) FromRaw(p *RawPacket) (err error)
FromRaw unmarshals the EncryptionResponse Packet from the given RawPacket.
func (*EncryptionResponse) ToRaw ¶
func (pi *EncryptionResponse) ToRaw(p *RawPacket) (err error)
ToRaw marshals the EncryptionResponse Packet to the given RawPacket.
type EntityMetadata ¶
type EntityMetadata struct{}
EntityMetadata represents miscellaneous information about an entity Implements proto.Type interface (Minecraft protocol data type). WARNING: EntityMetadata is not implemented in proto.
func (*EntityMetadata) ReadFrom ¶
func (e *EntityMetadata) ReadFrom(r io.Reader) (n int64, err error)
ReadFrom reads EntityMetadata data from r until an error occurs. The return value n is the number of bytes read. Any error encountered during the read is also returned. WARNING: EntityMetadata is not implemented in proto.
func (*EntityMetadata) WriteTo ¶
func (e *EntityMetadata) WriteTo(w io.Writer) (n int64, err error)
WriteTo writes EntityMetadata data to w until an error occurs. The return value n is the number of bytes written. Any error encountered during the write is also returned. WARNING: EntityMetadata is not implemented in proto.
type Float ¶
type Float float32
Float is a single-precision 32-bit IEEE 754 floating point number. Implements proto.Type interface (Minecraft protocol data type).
type Handshake ¶
type Handshake struct { ProtocolVersion VarInt ServerAddress String ServerPort UnsignedShort NextState VarInt }
Handshake is a packet that causes the server to switch into the target state. Serverbound (C -> S) Implements proto.Packet interface.
type Identifier ¶
type Identifier = String
Identifier is a namespaced location. Implements proto.Type interface (Minecraft protocol data type).
type Int ¶
type Int int32
Int is a signed 32-bit integer, two's complement. Implements proto.Type interface (Minecraft protocol data type).
type LegacyServerListPing ¶
type LegacyServerListPing struct {
Payload UnsignedByte
}
LegacyServerListPing is a packet asking for Server List Ping. While not technically part of the current protocol, modern servers should handle it correctly. Serverbound (C -> S) Implements proto.Packet interface.
func (*LegacyServerListPing) FromRaw ¶
func (l *LegacyServerListPing) FromRaw(p *RawPacket) (err error)
FromRaw unmarshals the LegacyServerListPing Packet from the given RawPacket.
func (*LegacyServerListPing) ToRaw ¶
func (l *LegacyServerListPing) ToRaw(p *RawPacket) (err error)
ToRaw marshals the LegacyServerListPing Packet to the given RawPacket.
type LoginDisconnect ¶
type LoginDisconnect struct {
Reason Chat
}
LoginDisconnect is a packet that tells the user they have been disconnected. Clientbound (S -> C) Implements proto.Packet interface.
func (*LoginDisconnect) FromRaw ¶
func (pi *LoginDisconnect) FromRaw(p *RawPacket) (err error)
FromRaw unmarshals the LoginDisconnect Packet from the given RawPacket.
func (*LoginDisconnect) ToRaw ¶
func (pi *LoginDisconnect) ToRaw(p *RawPacket) (err error)
ToRaw marshals the LoginDisconnect Packet to the given RawPacket.
type LoginPluginRequest ¶
type LoginPluginRequest struct { MessageID VarInt Channel Identifier Data ByteArray }
LoginPluginRequest is a packet used to implement a custom handshaking flow together with LoginPluginResponse. Clientbound (S -> C) Implements proto.Packet interface.
func (*LoginPluginRequest) FromRaw ¶
func (pi *LoginPluginRequest) FromRaw(p *RawPacket) (err error)
FromRaw unmarshals the LoginPluginRequest Packet from the given RawPacket.
func (*LoginPluginRequest) ToRaw ¶
func (pi *LoginPluginRequest) ToRaw(p *RawPacket) (err error)
ToRaw marshals the LoginPluginRequest Packet to the given RawPacket.
type LoginPluginResponse ¶
LoginPluginResponse is a packet used to implement a custom handshaking flow together with LoginPluginResponse. Serverbound (C -> S) Implements proto.Packet interface.
func (*LoginPluginResponse) FromRaw ¶
func (pi *LoginPluginResponse) FromRaw(p *RawPacket) (err error)
FromRaw unmarshals the LoginPluginResponse Packet from the given RawPacket.
func (*LoginPluginResponse) ToRaw ¶
func (pi *LoginPluginResponse) ToRaw(p *RawPacket) (err error)
ToRaw marshals the LoginPluginResponse Packet to the given RawPacket.
type LoginStart ¶
type LoginStart struct {
Name String
}
LoginStart is a packet sent by client to initiate the login process. Serverbound (C -> S) Implements proto.Packet interface.
func (*LoginStart) FromRaw ¶
func (pi *LoginStart) FromRaw(p *RawPacket) (err error)
FromRaw unmarshals the LoginStart Packet from the given RawPacket.
func (*LoginStart) ToRaw ¶
func (pi *LoginStart) ToRaw(p *RawPacket) (err error)
ToRaw marshals the LoginStart Packet to the given RawPacket.
type LoginSuccess ¶
LoginSuccess is a packet that tells the client they have successfully logged in. Clientbound (S -> C) Implements proto.Packet interface.
func (*LoginSuccess) FromRaw ¶
func (pi *LoginSuccess) FromRaw(p *RawPacket) (err error)
FromRaw unmarshals the LoginSuccess Packet from the given RawPacket.
func (*LoginSuccess) ToRaw ¶
func (pi *LoginSuccess) ToRaw(p *RawPacket) (err error)
ToRaw marshals the LoginSuccess Packet to the given RawPacket.
type Long ¶
type Long int64
Long is a signed 64-bit integer, two's complement. Implements proto.Type interface (Minecraft protocol data type).
type NBTTag ¶
type NBTTag struct{}
NBTTag represents an item and its associated data. Implements proto.Type interface (Minecraft protocol data type). WARNING: NBTTag is not implemented in proto.
type Ping ¶
type Ping struct {
Payload Long
}
Ping is a packet sent to ask a Pong response. Serverbound (C -> S) Implements proto.Packet interface.
type Pong ¶
type Pong struct {
Payload Long
}
Pong is a packet sent as a response to Ping. Clientbound (S -> C) Implements proto.Packet interface.
type Position ¶
type Position struct {
X, Y, Z int
}
Position is an integer/block position: x,y,z. Implements proto.Type interface (Minecraft protocol data type).
type RawPacket ¶
RawPacket is an unstructured Minecraft packet that contains id and raw data. It can be sent/received over Minecraft Network Protocol.
type Request ¶
type Request struct { }
Request is a packet asking for Server List Ping. Serverbound (C -> S) Implements proto.Packet interface.
type Response ¶
type Response struct {
JSONResponse String
}
Response is a packet that contains Server List Ping. Clientbound (S -> C) Implements proto.Packet interface.
type SetCompression ¶
type SetCompression struct {
Threshold VarInt
}
SetCompression is a packet that tells the client to use compression. Clientbound (S -> C) Implements proto.Packet interface.
func (*SetCompression) FromRaw ¶
func (pi *SetCompression) FromRaw(p *RawPacket) (err error)
FromRaw unmarshals the SetCompression Packet from the given RawPacket.
func (*SetCompression) ToRaw ¶
func (pi *SetCompression) ToRaw(p *RawPacket) (err error)
ToRaw marshals the SetCompression Packet to the given RawPacket.
type Short ¶
type Short int16
Short is a signed 16-bit integer, two's complement. Implements proto.Type interface (Minecraft protocol data type).
type Slot ¶
type Slot struct{}
Slot represents an item stack in an inventory or container. Implements proto.Type interface (Minecraft protocol data type). WARNING: Slot is not implemented in proto.
type String ¶
type String string
String is a sequence of Unicode scalar values. Implements proto.Type interface (Minecraft protocol data type).
type Type ¶
type Type interface { io.ReaderFrom io.WriterTo }
Type represents a Minecraft protocol data type. Implements io.ReaderFrom and io.WriterTo.
type UUID ¶
UUID is an uuid. Implements proto.Type interface (Minecraft protocol data type).
type UnsignedByte ¶
type UnsignedByte uint8
UnsignedByte is an unsigned 8-bit integer. Implements proto.Type interface (Minecraft protocol data type).
type UnsignedShort ¶
type UnsignedShort uint16
UnsignedShort is an unsigned 16-bit integer. Implements proto.Type interface (Minecraft protocol data type).
type VarInt ¶
type VarInt int32
VarInt is variable-length data encoding a two's complement signed 32-bit integer. Implements proto.Type interface (Minecraft protocol data type).
type VarLong ¶
type VarLong int64
VarLong is variable-length data encoding a two's complement signed 64-bit integer. Implements proto.Type interface (Minecraft protocol data type).