title

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package title contains title packets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(protocol proto.Protocol, title *Builder) (titlePacket proto.Packet, err error)

New creates a version and type dependent title packet.

Types

type Action

type Action int
const (
	SetTitle Action = iota
	SetSubtitle
	SetActionBar
	SetTimes
	Hide
	Reset
)

Title packets actions. (Numbered after the 1.11+ increment by 1)

func ProtocolAction

func ProtocolAction(protocol proto.Protocol, action Action) Action

ProtocolAction returns the correct action id for the protocol version since 1.11+ shifted the action enum by 1 to handle the action bar.

type Actionbar

type Actionbar struct{ Component string }

func (*Actionbar) Decode

func (a *Actionbar) Decode(_ *proto.PacketContext, rd io.Reader) (err error)

func (*Actionbar) Encode

func (a *Actionbar) Encode(_ *proto.PacketContext, wr io.Writer) error

type Builder

type Builder struct {
	Action                Action
	Component             component.Component
	FadeIn, Stay, FadeOut int // ticks
}

Builder is a Title packet builder.

type Clear

type Clear struct {
	// Either Hide or Reset. Falls back to Hide.
	Action Action
}

func (*Clear) Decode

func (c *Clear) Decode(_ *proto.PacketContext, rd io.Reader) error

func (*Clear) Encode

func (c *Clear) Encode(_ *proto.PacketContext, wr io.Writer) error

type Legacy

type Legacy struct {
	Action                Action
	Component             string
	FadeIn, Stay, FadeOut int
}

func (*Legacy) Decode

func (l *Legacy) Decode(c *proto.PacketContext, rd io.Reader) error

func (*Legacy) Encode

func (l *Legacy) Encode(c *proto.PacketContext, wr io.Writer) error

type Subtitle

type Subtitle struct{ Component string }

func (*Subtitle) Decode

func (s *Subtitle) Decode(_ *proto.PacketContext, rd io.Reader) (err error)

func (*Subtitle) Encode

func (s *Subtitle) Encode(_ *proto.PacketContext, wr io.Writer) error

type Text

type Text struct{ Component string }

func (*Text) Decode

func (t *Text) Decode(_ *proto.PacketContext, rd io.Reader) (err error)

func (*Text) Encode

func (t *Text) Encode(_ *proto.PacketContext, wr io.Writer) error

type Times

type Times struct{ FadeIn, Stay, FadeOut int }

func (*Times) Decode

func (t *Times) Decode(_ *proto.PacketContext, rd io.Reader) (err error)

func (*Times) Encode

func (t *Times) Encode(_ *proto.PacketContext, wr io.Writer) error

Jump to

Keyboard shortcuts

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