Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type McProto ¶
type McProto struct { Host string Port uint16 Name string ProtocolVersion int32 // contains filtered or unexported fields }
func (*McProto) GetCompressionTreshold ¶
func (*McProto) Initialize ¶
Initializes the connection to the server by sending the handshake packet and the login packet
Server Host, Port and Username are defined in the McProto object
func (*McProto) ReceivePacket ¶
func (mc *McProto) ReceivePacket() (packets.MinecraftPacket, error)
func (*McProto) WritePacket ¶
func (mc *McProto) WritePacket(packet MinecraftPacket) error
WritePacket calls SerializeData and then calls WriteRawPacket
func (*McProto) WriteRawPacket ¶ added in v0.0.2
func (mc *McProto) WriteRawPacket(packet MinecraftPacket) error
WriteRawPacket takes a packet with PacketID and Data already filled out, and serializes it to a byte slice, which is subsequently written to the underlying connection
type MinecraftPacket ¶ added in v0.0.2
type MinecraftPacket 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 // Serialize takes compressionTreshold as an input, which can be negative in case of a disabled // compression, and serializes it into a byte slice Serialize(compressionTreshold int32) ([]byte, error) }
MinecraftPacket 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
Click to show internal directories.
Click to hide internal directories.