title

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: Apache-2.0 Imports: 7 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

Action is the title action.

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 chat.ComponentHolder }

func (*Actionbar) Decode

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

func (*Actionbar) Encode

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

type Builder

type Builder struct {
	Action                Action
	Component             chat.ComponentHolder
	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             *chat.ComponentHolder
	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 chat.ComponentHolder }

func (*Subtitle) Decode

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

func (*Subtitle) Encode

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

type Text

type Text struct{ Component chat.ComponentHolder }

func (*Text) Decode

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

func (*Text) Encode

func (t *Text) Encode(c *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