block

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 9 Imported by: 9

Documentation

Index

Constants

View Source
const (
	FNV1_32_INIT  uint32 = 0x811C9DC5
	FNV1_PRIME_32 uint32 = 0x01000193
)

Variables

View Source
var (
	// RuntimeIDToState must hold a function to convert a runtime ID to a name and its state properties.
	RuntimeIDToState func(runtimeID uint32) (name string, properties map[string]any, found bool)
	// StateToRuntimeID must hold a function to convert a name and its state properties to a runtime ID.
	StateToRuntimeID func(name string, properties map[string]any) (runtimeID uint32, found bool)
)
View Source
var (
	// RuntimeIDToIndexState ..
	RuntimeIDToIndexState func(runtimeID uint32) (result block_general.IndexBlockState, found bool)
	// IndexStateToRuntimeID ..
	IndexStateToRuntimeID func(state block_general.IndexBlockState) (runtimeID uint32, found bool)
)
View Source
var (
	// AirRuntimeID is the runtime ID of an air block.
	AirRuntimeID uint32
)

Functions

func ComputeBlockHash

func ComputeBlockHash(blockName string, blockStates map[string]any) uint32

ComputeBlockHash compute the hash of block whose name is blockName, and states is blockStates. This implement is edited from https://gist.github.com/Alemiz112/504d0f79feac7ef57eda174b668dd345.

func Fnv1a_32

func Fnv1a_32(data []byte) uint32

Fnv1a_32 compute the fnv1a_32 hash of data.

func MarshalInternalData

func MarshalInternalData(key string, value any) []byte

MarshalInternalData marshal map[string]any{key: value} to its NBT represent. Note that only the internal results are returned, and the outer ones are not included.

For example, if key is "12" whose bytes is []byte{49, 50}, and value is int32(7), then the return result is []byte{3, 2, 0, 49, 50, 7, 0, 0, 0} but not []byte{10, 0, 0, 3, 2, 0, 49, 50, 7, 0, 0, 0, 0}.

The explanation of the example:

  • 3 => The type of value is TAG_Int (3)
  • 2, 0 => The length of key ("12") is 2 (little endian represent)
  • 49, 50 => The content of key ("12")
  • 7, 0, 0, 0 => The little endian represent of value (7)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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