Documentation ¶
Index ¶
- func Components(identifier string, b world.CustomBlock, blockID int32) map[string]any
- type ComponentBuilder
- func (builder *ComponentBuilder) AddComponent(name string, value any)
- func (builder *ComponentBuilder) AddPermutation(condition string, components map[string]any)
- func (builder *ComponentBuilder) AddProperty(name string, values []any)
- func (builder *ComponentBuilder) Construct() map[string]any
- func (builder *ComponentBuilder) SetMenuCategory(category category.Category)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Components ¶
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.