iteminternal

package
v0.9.14 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Components

func Components(it world.CustomItem) map[string]any

Components returns all the components of the given custom item. If the item has no components, a nil map and false are returned.

Types

type ComponentBuilder

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

ComponentBuilder represents a builder that can be used to construct an item components map to be sent to a client.

func NewComponentBuilder

func NewComponentBuilder(name, identifier string, category category.Category) *ComponentBuilder

NewComponentBuilder returns a new component builder with the provided item data.

func (*ComponentBuilder) AddComponent

func (builder *ComponentBuilder) AddComponent(name string, value any)

AddComponent adds the provided component to the builder.

func (*ComponentBuilder) AddProperty

func (builder *ComponentBuilder) AddProperty(name string, value any)

AddProperty adds the provided property to the builder.

func (*ComponentBuilder) Construct

func (builder *ComponentBuilder) Construct() map[string]any

Construct constructs the final item components map and returns it. It also applies the default properties required for the item to work without modifying the original maps in the builder.

Jump to

Keyboard shortcuts

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