packbuilder

package
v0.0.0-...-1cf8517 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildResourcePack

func BuildResourcePack(customItems []world.CustomItem, version string) (*resource.Pack, bool)

BuildResourcePack builds a resource pack based on custom features that have been registered to the server. It creates a UUID based on the hash of the directory so the client will only be prompted to download it once it is changed.

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