nbtconv

package
v1.36.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Block added in v1.28.1

func Block(m map[string]any, k string) world.Block

Block decodes the data of a block into a world.Block.

func Bool added in v1.28.1

func Bool(m map[string]any, k string) bool

Bool reads a uint8 value from a map at key k and returns true if it equals 1.

func Float32 added in v1.28.1

func Float32(m map[string]any, k string) float32

Float32 reads a float32 value from a map at key k.

func Float64 added in v1.28.1

func Float64(m map[string]any, k string) float64

Float64 reads a float64 value from a map at key k.

func Int16 added in v1.28.1

func Int16(m map[string]any, k string) int16

Int16 reads an int16 value from a map at key k.

func Int32 added in v1.28.1

func Int32(m map[string]any, k string) int32

Int32 reads an int32 value from a map at key k.

func Int32FromRGBA

func Int32FromRGBA(x color.RGBA) int32

Int32FromRGBA converts a color.RGBA into an int32. These int32s are present in, for example, signs.

func Int64 added in v1.28.1

func Int64(m map[string]any, k string) int64

Int64 reads an int16 value from a map at key k.

func InvFromNBT

func InvFromNBT(inv *inventory.Inventory, items []any)

InvFromNBT decodes the data of an NBT slice into the inventory passed.

func InvToNBT

func InvToNBT(inv *inventory.Inventory) []map[string]any

InvToNBT encodes an inventory to a data slice which may be encoded as NBT.

func Item added in v1.28.1

func Item(data map[string]any, s *item.Stack) item.Stack

Item decodes the data of an item into an item stack.

func MapItem

func MapItem(x map[string]any, k string) item.Stack

MapItem converts an item's name, count, damage (and properties when it is a block) in a map obtained by decoding NBT to a world.Item.

func Pos added in v1.28.1

func Pos(x map[string]any, k string) cube.Pos

Pos converts x, y and z values in an NBT map to a cube.Pos.

func PosToInt32Slice

func PosToInt32Slice(x cube.Pos) []int32

PosToInt32Slice converts a cube.Pos to a []int32 with 3 elements.

func RGBAFromInt32

func RGBAFromInt32(x int32) color.RGBA

RGBAFromInt32 converts an int32 into a color.RGBA. These int32s are present in, for example, signs.

func Slice added in v1.28.1

func Slice(m map[string]any, k string) []any

Slice reads a []any value from a map at key k.

func String added in v1.28.1

func String(m map[string]any, k string) string

String reads a string value from a map at key k.

func TickDuration added in v1.28.1

func TickDuration[T constraints.Integer](m map[string]any, k string) time.Duration

TickDuration reads a uint8/int16/in32 value from a map at key k and converts it from ticks to a time.Duration.

func Uint8 added in v1.28.1

func Uint8(m map[string]any, k string) uint8

Uint8 reads a uint8 value from a map at key k.

func Vec3 added in v1.28.1

func Vec3(x map[string]any, k string) mgl64.Vec3

Vec3 converts x, y and z values in an NBT map to an mgl64.Vec3.

func Vec3ToFloat32Slice

func Vec3ToFloat32Slice(x mgl64.Vec3) []float32

Vec3ToFloat32Slice converts an mgl64.Vec3 to a []float32 with 3 elements.

func WriteBlock

func WriteBlock(b world.Block) map[string]any

WriteBlock encodes a world.Block into a map that can be encoded using NBT.

func WriteItem

func WriteItem(s item.Stack, disk bool) map[string]any

WriteItem encodes an item stack into a map that can be encoded using NBT.

Types

This section is empty.

Jump to

Keyboard shortcuts

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