blockupgrader

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2025 License: MIT Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterSchema

func RegisterSchema(r io.Reader) error

RegisterSchema attempts to decode and parse a schema from the provided file reader. The file must follow the correct specification otherwise an error will be returned.

Types

type Block

type Block interface {
	// contains filtered or unexported methods
}

Block holds the data that identifies a block. It is implemented by BlockState and BlockMeta.

type BlockMeta

type BlockMeta struct {
	Name     string `nbt:"name"`
	Metadata int16  `nbt:"meta"`
}

BlockMeta holds the name and metadata value (int16) of a block. This format is used by blocks from Minecraft Bedrock Edition versions before v1.13.

type BlockState

type BlockState struct {
	Name       string         `nbt:"name"`
	Properties map[string]any `nbt:"states"`
	Version    int32          `nbt:"version"`
}

BlockState holds the name, properties and version of a block. The name and properties of the same block may differ, depending on the Version.

func Upgrade

func Upgrade(b Block) BlockState

Upgrade upgrades the given block using the registered block state upgrade schemas. If a Block has not been changed through several versions, Upgrade will simply return the original value. Calling blockupgrader.Upgrade is therefore safe regardless of whether the block is already up-to-date or not.

Jump to

Keyboard shortcuts

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