latest

package
v0.0.0-...-b1a0a32 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//go:embed block_states.nbt
	BlockStateData []byte
	//go:embed item_runtime_ids.nbt
	ItemRuntimeIDData []byte
)

Functions

func ItemNameToRuntimeID

func ItemNameToRuntimeID(name string) (runtimeID int32, found bool)

ItemNameToRuntimeID converts a string ID to an item runtime ID.

func ItemRuntimeIDToName

func ItemRuntimeIDToName(runtimeID int32) (name string, found bool)

ItemRuntimeIDToName converts an item runtime ID to a string ID.

func RuntimeIDToState

func RuntimeIDToState(runtimeID uint32) (name string, properties map[string]any, found bool)

RuntimeIDToState converts a runtime ID to a name and its state properties.

func StateToRuntimeID

func StateToRuntimeID(name string, properties map[string]any) (runtimeID uint32, found bool)

StateToRuntimeID converts a name and its state properties to a runtime ID.

Types

type State

type State struct {
	// Name is the name of the block.
	Name string `nbt:"name"`
	// Properties is a map of properties that define the block's state.
	Properties map[string]any `nbt:"states"`
	// Version is the version of the block state.
	Version int32 `nbt:"version"`
}

State holds a combination of a name and properties, together with a version.

type StateHash

type StateHash struct {
	Name, Properties string
}

StateHash is a struct that may be used as a map key for block states. It contains the name of the block state and an encoded version of the properties.

func HashState

func HashState(state blockupgrader.BlockState) StateHash

HashState produces a hash for the block properties held by the blockState.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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