client

package
v0.0.0-...-6f503ef Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2023 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PlayerInfoAddPlayer = iota
	PlayerInfoInitializeChat
	PlayerInfoUpdateGameMode
	PlayerInfoUpdateListed
	PlayerInfoUpdateLatency
	PlayerInfoUpdateDisplayName
	// PlayerInfoEnumGuard is the number of the enums
	PlayerInfoEnumGuard
)

Actions of [SendPlayerInfoUpdate]

Variables

This section is empty.

Functions

func NewPlayerInfoAction

func NewPlayerInfoAction(actions ...int) pk.FixedBitSet

Types

type Client

type Client struct {

	// pointer to the Player.Input
	*world.Inputs
	// contains filtered or unexported fields
}

func New

func New(log *zap.Logger, conn *net.Conn, player *world.Player) *Client

func (*Client) AddHandler

func (c *Client) AddHandler(id packetid.ServerboundPacketID, handler PacketHandler)

func (*Client) GetPlayer

func (c *Client) GetPlayer() *world.Player

func (*Client) SendAddPlayer

func (c *Client) SendAddPlayer(p *world.Player)

func (*Client) SendDisconnect

func (c *Client) SendDisconnect(reason chat.Message)

SendDisconnect send ClientboundDisconnect packet to client. Once the packet is sent, the connection will be closed.

func (*Client) SendForgetLevelChunk

func (c *Client) SendForgetLevelChunk(pos level.ChunkPos)

func (*Client) SendKeepAlive

func (c *Client) SendKeepAlive(id int64)

func (*Client) SendLevelChunkWithLight

func (c *Client) SendLevelChunkWithLight(pos level.ChunkPos, chunk *level.Chunk)

func (*Client) SendLogin

func (c *Client) SendLogin(w *world.World, p *world.Player)

func (*Client) SendMoveEntitiesPos

func (c *Client) SendMoveEntitiesPos(eid int32, delta [3]int16, onGround bool)

func (*Client) SendMoveEntitiesPosAndRot

func (c *Client) SendMoveEntitiesPosAndRot(eid int32, delta [3]int16, rot [2]int8, onGround bool)

func (*Client) SendMoveEntitiesRot

func (c *Client) SendMoveEntitiesRot(eid int32, rot [2]int8, onGround bool)

func (*Client) SendPacket

func (c *Client) SendPacket(id packetid.ClientboundPacketID, fields ...pk.FieldEncoder)

func (*Client) SendPlayerChat

func (c *Client) SendPlayerChat(
	sender uuid.UUID,
	index int32,
	signature pk.Option[sign.Signature, *sign.Signature],
	body *sign.PackedMessageBody,
	unsignedContent *chat.Message,
	filter *sign.FilterMask,
	chatType *chat.Type,
)

func (*Client) SendPlayerInfoRemove

func (c *Client) SendPlayerInfoRemove(players []*world.Player)

func (*Client) SendPlayerInfoUpdate

func (c *Client) SendPlayerInfoUpdate(actions pk.FixedBitSet, players []*world.Player)

func (*Client) SendPlayerPosition

func (c *Client) SendPlayerPosition(pos [3]float64, rot [2]float32) (teleportID int32)

func (*Client) SendRemoveEntities

func (c *Client) SendRemoveEntities(entityIDs []int32)

func (*Client) SendRotateHead

func (c *Client) SendRotateHead(eid int32, yaw int8)

func (*Client) SendServerData

func (c *Client) SendServerData(motd *chat.Message, favIcon string, enforceSecureProfile bool)

func (*Client) SendSetChunkCacheCenter

func (c *Client) SendSetChunkCacheCenter(chunkPos [2]int32)

func (*Client) SendSetDefaultSpawnPosition

func (c *Client) SendSetDefaultSpawnPosition(xyz [3]int32, angle float32)

func (*Client) SendSystemChat

func (c *Client) SendSystemChat(msg chat.Message, overlay bool)

func (*Client) SendTeleportEntity

func (c *Client) SendTeleportEntity(eid int32, pos [3]float64, rot [2]int8, onGround bool)

func (*Client) Start

func (c *Client) Start()

func (*Client) ViewAddPlayer

func (c *Client) ViewAddPlayer(p *world.Player)

func (*Client) ViewChunkLoad

func (c *Client) ViewChunkLoad(pos level.ChunkPos, chunk *level.Chunk)

func (*Client) ViewChunkUnload

func (c *Client) ViewChunkUnload(pos level.ChunkPos)

func (*Client) ViewMoveEntityPos

func (c *Client) ViewMoveEntityPos(id int32, delta [3]int16, onGround bool)

func (*Client) ViewMoveEntityPosAndRot

func (c *Client) ViewMoveEntityPosAndRot(id int32, delta [3]int16, rot [2]int8, onGround bool)

func (*Client) ViewMoveEntityRot

func (c *Client) ViewMoveEntityRot(id int32, rot [2]int8, onGround bool)

func (*Client) ViewRemoveEntities

func (c *Client) ViewRemoveEntities(entityIDs []int32)

func (*Client) ViewRotateHead

func (c *Client) ViewRotateHead(id int32, yaw int8)

func (*Client) ViewTeleportEntity

func (c *Client) ViewTeleportEntity(id int32, pos [3]float64, rot [2]int8, onGround bool)

type PacketHandler

type PacketHandler func(p pk.Packet, c *Client) error

Jump to

Keyboard shortcuts

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