ptypes

package
v1.16.5-pre Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package ptypes implements encoding and decoding for high-level packets.

Package ptypes implements encoding and decoding for high-level packets.

Package ptypes implements encoding and decoding for high-level packets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatMessageClientbound

type ChatMessageClientbound struct {
	S      chat.Message
	Pos    pk.Byte
	Sender pk.UUID
}

ChatMessageClientbound represents a chat message forwarded by the server.

func (*ChatMessageClientbound) Decode

func (p *ChatMessageClientbound) Decode(pkt pk.Packet) error

type ChunkData

type ChunkData struct {
	X, Z           pk.Int
	FullChunk      pk.Boolean
	PrimaryBitMask pk.VarInt
	Heightmaps     struct{}
	Biomes         biomesData
	Data           chunkData
	BlockEntities  blockEntities
}

ChunkData is a client-bound packet which describes a chunk.

func (*ChunkData) Decode

func (p *ChunkData) Decode(pkt pk.Packet) error

type ConfirmTransaction

type ConfirmTransaction struct {
	WindowID pk.Byte
	ActionID pk.Short
	Accepted pk.Boolean
}

func (*ConfirmTransaction) Decode

func (p *ConfirmTransaction) Decode(pkt pk.Packet) error

func (ConfirmTransaction) Encode

func (p ConfirmTransaction) Encode() pk.Packet

type EntityAnimationClientbound

type EntityAnimationClientbound struct {
	ID        pk.VarInt
	Animation pk.UnsignedByte
}

EntityAnimationClientbound updates the animation state of an entity.

func (*EntityAnimationClientbound) Decode

func (p *EntityAnimationClientbound) Decode(pkt pk.Packet) error

type EntityPosition

type EntityPosition struct {
	ID       pk.VarInt
	X, Y, Z  pk.Short // Deltas
	OnGround pk.Boolean
}

EntityPosition is a clientbound packet used to update an entities position.

func (*EntityPosition) Decode

func (p *EntityPosition) Decode(pkt pk.Packet) error

type EntityPositionLook

type EntityPositionLook struct {
	ID         pk.VarInt
	X, Y, Z    pk.Short // Deltas
	Yaw, Pitch pk.Angle
	OnGround   pk.Boolean
}

EntityPosition is a clientbound packet used to update an entities position and its rotation.

func (*EntityPositionLook) Decode

func (p *EntityPositionLook) Decode(pkt pk.Packet) error

type EntityRotation

type EntityRotation struct {
	ID         pk.VarInt
	Yaw, Pitch pk.Angle
	OnGround   pk.Boolean
}

EntityRotation is a clientbound packet used to update an entities rotation.

func (*EntityRotation) Decode

func (p *EntityRotation) Decode(pkt pk.Packet) error

type JoinGame

type JoinGame struct {
	PlayerEntity pk.Int
	Hardcore     pk.Boolean
	Gamemode     pk.UnsignedByte
	PrevGamemode pk.UnsignedByte
	WorldCount   pk.VarInt
	WorldNames   pk.Identifier
	//DimensionCodec pk.NBT
	Dimension  pk.Int
	WorldName  pk.Identifier
	HashedSeed pk.Long

	ViewDistance pk.VarInt
	RDI          pk.Boolean // Reduced Debug Info
	ERS          pk.Boolean // Enable respawn screen
	IsDebug      pk.Boolean
	IsFlat       pk.Boolean
	// contains filtered or unexported fields
}

JoinGame encodes global/world information from the server.

func (*JoinGame) Decode

func (p *JoinGame) Decode(pkt pk.Packet) error

type Look

type Look struct {
	Yaw, Pitch pk.Float
	OnGround   pk.Boolean
}

Look describes the rotation of the player.

func (Look) Encode

func (p Look) Encode() pk.Packet

type NamedSoundEffect

type NamedSoundEffect struct {
	Sound         pk.String
	Category      pk.VarInt
	X, Y, Z       pk.Int
	Volume, Pitch pk.Float
}

NamedSoundEffect is a client-bound packet used to play a sound with the specified name on the client.

func (*NamedSoundEffect) Decode

func (p *NamedSoundEffect) Decode(pkt pk.Packet) error

type OpenWindow

type OpenWindow struct {
	WindowID   pk.VarInt
	WindowType pk.VarInt
	Title      chat.Message
}

OpenWindow is a clientbound packet which opens an inventory.

func (*OpenWindow) Decode

func (p *OpenWindow) Decode(pkt pk.Packet) error

type PluginData

type PluginData []byte

PluginData encodes the custom data encoded in a plugin message.

func (*PluginData) Decode

func (p *PluginData) Decode(r pk.DecodeReader) error

func (PluginData) Encode

func (p PluginData) Encode() []byte

type PluginMessage

type PluginMessage struct {
	Channel pk.Identifier
	Data    PluginData
}

PluginMessage represents a packet with a customized payload.

func (*PluginMessage) Decode

func (p *PluginMessage) Decode(pkt pk.Packet) error

func (*PluginMessage) Encode

func (p *PluginMessage) Encode() pk.Packet

type Position

type Position struct {
	X, Y, Z  pk.Double
	OnGround pk.Boolean
}

Position describes the position of the player.

func (Position) Encode

func (p Position) Encode() pk.Packet

type PositionAndLookClientbound

type PositionAndLookClientbound struct {
	X, Y, Z    pk.Double
	Yaw, Pitch pk.Float
	Flags      pk.Byte
	TeleportID pk.VarInt
}

PositionAndLookClientbound describes the location and orientation of the player.

func (*PositionAndLookClientbound) Decode

func (p *PositionAndLookClientbound) Decode(pkt pk.Packet) error

func (*PositionAndLookClientbound) RelativePitch

func (p *PositionAndLookClientbound) RelativePitch() bool

func (*PositionAndLookClientbound) RelativeX

func (p *PositionAndLookClientbound) RelativeX() bool

func (*PositionAndLookClientbound) RelativeY

func (p *PositionAndLookClientbound) RelativeY() bool

func (*PositionAndLookClientbound) RelativeYaw

func (p *PositionAndLookClientbound) RelativeYaw() bool

func (*PositionAndLookClientbound) RelativeZ

func (p *PositionAndLookClientbound) RelativeZ() bool

type PositionAndLookServerbound

type PositionAndLookServerbound struct {
	X, Y, Z    pk.Double
	Yaw, Pitch pk.Float
	OnGround   pk.Boolean
}

PositionAndLookServerbound describes the location and orientation of the player.

func (PositionAndLookServerbound) Encode

type SetSlot

type SetSlot struct {
	WindowID pk.Byte
	Slot     pk.Short
	SlotData entity.Slot
}

SetSlot is a clientbound packet which configures an inventory slot. A window ID of -1 represents the cursor, and a window ID of 0 represents the players inventory.

func (*SetSlot) Decode

func (p *SetSlot) Decode(pkt pk.Packet) error

type SoundEffect

type SoundEffect struct {
	Sound         pk.VarInt
	Category      pk.VarInt
	X, Y, Z       pk.Int
	Volume, Pitch pk.Float
}

SoundEffect is a client-bound packet used to play a specific sound ID on the client.

func (*SoundEffect) Decode

func (p *SoundEffect) Decode(pkt pk.Packet) error

type SpawnEntity

type SpawnEntity struct {
	ID               pk.VarInt
	UUID             pk.UUID
	Type             pk.VarInt
	X, Y, Z          pk.Double
	Pitch, Yaw       pk.Angle
	Data             pk.Int
	VelX, VelY, VelZ pk.Short
}

SpawnEntity is a client-bound packet used to spawn a non-mob entity.

func (*SpawnEntity) Decode

func (p *SpawnEntity) Decode(pkt pk.Packet) error

type SpawnLivingEntity

type SpawnLivingEntity struct {
	ID               pk.VarInt
	UUID             pk.UUID
	Type             pk.VarInt
	X, Y, Z          pk.Double
	Yaw, Pitch       pk.Angle
	HeadPitch        pk.Angle
	VelX, VelY, VelZ pk.Short
}

SpawnLivingEntity is a client-bound packet used to spawn a mob.

func (*SpawnLivingEntity) Decode

func (p *SpawnLivingEntity) Decode(pkt pk.Packet) error

type SpawnPlayer

type SpawnPlayer struct {
	ID         pk.VarInt
	UUID       pk.UUID
	X, Y, Z    pk.Double
	Yaw, Pitch pk.Angle
}

SpawnPlayer is a client-bound packet used to describe a player entering visible range.

func (*SpawnPlayer) Decode

func (p *SpawnPlayer) Decode(pkt pk.Packet) error

type TileEntityData

type TileEntityData struct {
	Pos    pk.Position
	Action pk.UnsignedByte
	Data   entity.BlockEntity
}

TileEntityData describes a change to a tile entity.

func (*TileEntityData) Decode

func (p *TileEntityData) Decode(pkt pk.Packet) error

type UpdateHealth

type UpdateHealth struct {
	Health         pk.Float
	Food           pk.VarInt
	FoodSaturation pk.Float
}

UpdateHealth encodes player health/food information from the server.

func (*UpdateHealth) Decode

func (p *UpdateHealth) Decode(pkt pk.Packet) error

type WindowItems

type WindowItems struct {
	WindowID pk.Byte
	Slots    []entity.Slot
}

WindowItems is a clientbound packet describing the contents of multiple inventory slots in a window/inventory.

func (*WindowItems) Decode

func (p *WindowItems) Decode(pkt pk.Packet) error

Jump to

Keyboard shortcuts

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