legacy

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: Apache-2.0 Imports: 7 Imported by: 14

Documentation

Index

Constants

View Source
const (
	DefaultChar    = SectionChar
	DefaultHexChar = HexChar

	// The legacy character used by Minecraft.
	SectionChar rune = '§'
	// The legacy character frequently used by configurations and commands.
	AmpersandChar rune = '&'
	// The character used to prefix hex colors.
	HexChar rune = '#'

	Chars = "0123456789abcdefklmnor"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FormatCodeType

type FormatCodeType uint8
const (
	MojangLegacy FormatCodeType = iota
)

type Legacy

type Legacy struct {
	Char    rune // The format char to use (e.g. DefaultChar, SectionChar, AmpersandChar).
	HexChar rune // The hex prefixing char to use (e.g. HexChar).

	// Since Minecraft 1.16+ there can be hex colors (e.g. "#ff5555" instead of the named color "red").
	// This setting decides whether to use the nearest legacy named color of the hex color instead.
	//
	// This setting is false by default to support older client versions.
	NoDownsampleColor bool

	// Whether to add a "open_url" click event with the URL to the text containing an URL.
	ClickableUrl bool
}

func (*Legacy) Marshal

func (l *Legacy) Marshal(wr io.Writer, c Component) error

func (*Legacy) Unmarshal

func (l *Legacy) Unmarshal(data []byte) (Component, error)

Unmarshal takes a string and always returns the *component.Text from it or an error.

type Reset

type Reset struct{}

Reset is the legacy reset format.

func (Reset) String

func (Reset) String() string

String implements component.Format.

Jump to

Keyboard shortcuts

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