blockinternal

package
v0.9.20 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Components

func Components(identifier string, b world.CustomBlock, blockID int32) map[string]any

Components returns all the components for the custom block, including permutations and properties.

Types

type ComponentBuilder

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

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

func NewComponentBuilder

func NewComponentBuilder(identifier string, components map[string]any, blockID int32) *ComponentBuilder

NewComponentBuilder returns a new component builder with the provided block data, using the provided components map as a base.

func (*ComponentBuilder) AddComponent

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

AddComponent adds the provided component to the builder. If the component already exists, it will be overwritten.

func (*ComponentBuilder) AddPermutation

func (builder *ComponentBuilder) AddPermutation(condition string, components map[string]any)

AddPermutation adds a permutation to the builder. If there is already an existing permutation for the provided condition, the new components will be added to the existing permutation.

func (*ComponentBuilder) AddProperty

func (builder *ComponentBuilder) AddProperty(name string, values []any)

AddProperty adds the provided block property to the builder.

func (*ComponentBuilder) Construct

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

Construct constructs the final block components map that is ready to be sent to the client.

func (*ComponentBuilder) SetMenuCategory

func (builder *ComponentBuilder) SetMenuCategory(category category.Category)

SetMenuCategory sets the creative category for the current block.

Jump to

Keyboard shortcuts

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