common

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const VarContinueBit = 0x80
View Source
const VarSegmentBits = 0x7F

Variables

View Source
var IdentifierNameSpaceRegex = regexp.MustCompile(`^[a-z0-9._-]+$`)
View Source
var IdentifierValueRegex = regexp.MustCompile(`^[a-z0-9/._-]+$`)

Functions

func DecodeMCString added in v1.0.2

func DecodeMCString(input *bytes.Buffer) (*string, error)

Types

type Angle

type Angle float32

type AwardStatistic

type AwardStatistic struct {
	CategoryID  VarInt
	StatisticID VarInt
	Value       VarInt
}

type AwardStatistics

type AwardStatistics []AwardStatistic

type BitSet

type BitSet struct {
	// contains filtered or unexported fields
}

func NewBitSet

func NewBitSet(size uint) BitSet

func (*BitSet) Flip

func (b *BitSet) Flip(index uint)

func (*BitSet) Get

func (b *BitSet) Get(index uint) bool

func (*BitSet) Length

func (b *BitSet) Length() uint

func (*BitSet) Set

func (b *BitSet) Set(index uint)

func (*BitSet) String

func (b *BitSet) String() string

type BlockEntity

type BlockEntity struct {
	PackedXZ byte
	Y        int16
	Type     VarInt
	Data     nbt.NBT
}

type BlockLightArray

type BlockLightArray struct {
	Length VarInt
	Data   []byte
}

type BlockPosition

type BlockPosition uint64

func NewBlockPosition

func NewBlockPosition(x, y, z int32) BlockPosition

func (BlockPosition) X

func (p BlockPosition) X() int32

func (BlockPosition) Y

func (p BlockPosition) Y() int32

func (BlockPosition) Z

func (p BlockPosition) Z() int32

type Chat

type Chat struct {
	*ChatComponent
	Extra []ChatComponent `json:"extra"`
}

type ChatClickEvent

type ChatClickEvent struct {
	OpenURL         string `json:"open_url"`
	OpenFile        string `json:"open_file"`
	RunCommand      string `json:"run_command"`
	TwitchUserInfo  string `json:"twitch_user_info"`
	SuggestCommand  string `json:"suggest_command"`
	ChangePage      string `json:"change_page"`
	CopyToClipboard string `json:"copy_to_clipboard"`
}

type ChatCommandSignature

type ChatCommandSignature struct {
	ArgumentName string
	Signature    []byte
}

type ChatComponent

type ChatComponent struct {
	Text          string         `json:"text"`
	Bold          bool           `json:"bold"`
	Italic        bool           `json:"italic"`
	Underlined    bool           `json:"underlined"`
	Strikethrough bool           `json:"strikethrough"`
	Obfuscated    bool           `json:"obfuscated"`
	Font          string         `json:"font"`
	Color         string         `json:"color"`
	Insertion     string         `json:"insertion"`
	ClickEvent    ChatClickEvent `json:"clickEvent"`
	HoverEvent    ChatHoverEvent `json:"hoverEvent"`
}

type ChatHoverEvent

type ChatHoverEvent struct {
	ShowText        string `json:"show_text"`
	ShowItem        string `json:"show_item"`
	ShowEntity      string `json:"show_entity"`
	ShowAchievement string `json:"show_achievement"`
}

type ChunkSection

type ChunkSection struct {
	BlockCount  int16
	BlockStates PalettedContainerStructure
	Biomes      PalettedContainerStructure
}

type CommandNode

type CommandNode struct {
	Flags         byte // TODO: Enum
	ChildrenCount VarInt
	Children      []VarInt
	RedirectNode  *VarInt
	Name          *string
	ParserID      *VarInt
	//Properties    *CommandNodeProperties // TODO: Figure out
	SuggestionsType *Identifier
}

CommandNode is a node in a command tree. Refer to https://wiki.vg/Command_Data

type DirectPalette

type DirectPalette struct{}

type Hand

type Hand VarInt
const (
	MainHand Hand = iota
	OffHand
)

type Identifier

type Identifier string

func (Identifier) ValidateNameSpace

func (i Identifier) ValidateNameSpace() error

func (Identifier) ValidateValue

func (i Identifier) ValidateValue() error

type IndirectPalette

type IndirectPalette struct {
	PaletteLength VarInt
	Palette       []VarInt
}

type MCString added in v1.0.2

type MCString string

func (MCString) ByteLength added in v1.0.2

func (s MCString) ByteLength() int

func (MCString) Encode added in v1.0.2

func (s MCString) Encode() []byte

type Palette

type PalettedContainerStructure

type PalettedContainerStructure struct {
	BitsPerEntry    uint8
	Palette         Palette
	DataArrayLength VarInt
	DataArray       []int64
}

type PlayerInfoActionAddPlayer

type PlayerInfoActionAddPlayer struct {
	Name            string
	PropertiesCount VarInt
	Properties      []PlayerInfoActionAddPlayerProperty
}

type PlayerInfoActionAddPlayerProperty

type PlayerInfoActionAddPlayerProperty struct {
	Name      string
	Value     string
	IsSigned  bool
	Signature string
}

type PlayerInfoActionUpdateDisplayName

type PlayerInfoActionUpdateDisplayName struct {
	HasDisplayName bool
	DisplayName    *Chat
}

type PlayerInfoActionUpdateGameMode

type PlayerInfoActionUpdateGameMode struct {
	GameMode VarInt
}

type PlayerInfoActionUpdateInitializeChat

type PlayerInfoActionUpdateInitializeChat struct {
	HasSignatureData       bool
	ChatSessionID          uuid.UUID
	EncodedPublicKeySize   VarInt
	EncodedPublicKey       []byte
	PublicKeySignatureSize VarInt
	PublicKeySignature     []byte
}

type PlayerInfoActionUpdateLatency

type PlayerInfoActionUpdateLatency struct {
	Ping VarInt
}

type PlayerInfoActionUpdateListed

type PlayerInfoActionUpdateListed struct {
	IsListed bool
}

type PublicKey

type PublicKey struct {
	ExpiresAt          int64
	PublicKeyLength    VarInt
	PublicKey          []byte
	KeySignatureLength VarInt
	KeySignature       []byte
}

PublicKey is a struct that represents a public key. Refer to https://wiki.vg/Protocol#Player_Session

type SingleValuedPalette

type SingleValuedPalette struct {
	Value VarInt
}

type SkyLightArray

type SkyLightArray struct {
	Length VarInt
	Data   []byte
}

type Slot

type Slot struct {
	IsPresent bool
	ItemID    VarInt
	ItemCount byte
	NBTData   nbt.NBT
}

type SuccessProperty

type SuccessProperty struct {
	Name      string
	Value     string
	IsSigned  bool
	Signature string
}

type VarInt

type VarInt int32

func DecodeVarInt

func DecodeVarInt(input *bytes.Buffer) (*VarInt, error)

func (VarInt) ByteLength

func (i VarInt) ByteLength() int

func (VarInt) Encode

func (i VarInt) Encode() []byte

type VarLong

type VarLong int64

func DecodeVarLong

func DecodeVarLong(input *bytes.Buffer) (*VarLong, error)

func (VarLong) ByteLength

func (l VarLong) ByteLength() int

func (VarLong) Encode

func (l VarLong) Encode() []byte

Jump to

Keyboard shortcuts

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