Documentation ¶
Index ¶
- type Boolean
- type Client
- func (mc *Client) Connect(ip string, port uint16, player entities.Player, protocolVersion int32) error
- func (mc *Client) GetAddr() string
- func (mc *Client) IsCompressionEnabled() bool
- func (mc *Client) ReceivePacket() (*packets.MinecraftPacket, error)
- func (mc *Client) ReceiveRawPacket() (*packets.MinecraftRawPacket, error)
- func (mc *Client) WritePacket(packet SerializablePacket) error
- func (mc *Client) WriteRawPacket(rawPacket *packets.MinecraftRawPacket) error
- type Double
- type Float
- type Identifier
- type Int
- type JSONTextComponent
- type Long
- type SerializablePacket
- type Short
- type String
- type TextComponent
- type UnsignedByte
- type UnsignedShort
- type VarInt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Connect ¶
func (mc *Client) Connect(ip string, port uint16, player entities.Player, protocolVersion int32) error
Connect to a server addr format must be "ip:port"
func (*Client) IsCompressionEnabled ¶
func (*Client) ReceivePacket ¶
func (mc *Client) ReceivePacket() (*packets.MinecraftPacket, error)
ReceivePacket receives and deserializes a packet from the con, uncompressing it if necessary
func (*Client) ReceiveRawPacket ¶
func (mc *Client) ReceiveRawPacket() (*packets.MinecraftRawPacket, error)
ReceiveRawPacket reads a raw packet from the con but doesn't deserialize neither uncompress it
func (*Client) WritePacket ¶
func (mc *Client) WritePacket(packet SerializablePacket) error
WritePacket calls SerializeData and then calls WriteRawPacket
func (*Client) WriteRawPacket ¶
func (mc *Client) WriteRawPacket(rawPacket *packets.MinecraftRawPacket) error
WriteRawPacket takes a rawpacket as input and serializes it in the con
type Identifier ¶
type Identifier string //max length: 32767
type JSONTextComponent ¶
type JSONTextComponent string
type SerializablePacket ¶
type SerializablePacket interface { // SerializeData takes an interface pointer as input and serializes all the fields in the // data buffer. It can and will return an error in case of invalid data SerializeData(inter interface{}) error SerializeCompressed(writer io.Writer, compressionThreshold int) error SerializeUncompressed(writer io.Writer) error }
SerializablePacket defines the standard methods that a struct should have in order to be serializable by the library
You can actually create your own methods as long as they respect this standard
type TextComponent ¶
type TextComponent string
type UnsignedByte ¶
type UnsignedByte uint8
type UnsignedShort ¶
type UnsignedShort uint16
Click to show internal directories.
Click to hide internal directories.