nbtconv

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Int32FromRGBA added in v0.2.0

func Int32FromRGBA(x color.RGBA) int32

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

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 Map added in v0.6.0

func Map[T any](m map[string]any, key string) T

Map reads a value of the type T from the map passed. Map never panics. If the key was not found in the map or if the value was of a different type, the default value of type T is returned.

func MapBlock added in v0.2.0

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

MapBlock converts a block's name and properties in a map obtained by decoding NBT to a world.Block.

func MapItem added in v0.2.0

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 MapPos added in v0.6.0

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

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

func MapVec3 added in v0.2.0

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

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

func PosToInt32Slice added in v0.6.0

func PosToInt32Slice(x cube.Pos) []int32

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

func RGBAFromInt32 added in v0.2.0

func RGBAFromInt32(x int32) color.RGBA

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

func ReadBlock added in v0.3.0

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

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

func ReadItem added in v0.3.0

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

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

func Vec3ToFloat32Slice added in v0.2.0

func Vec3ToFloat32Slice(x mgl64.Vec3) []float32

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

func WriteBlock added in v0.3.0

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

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

func WriteItem added in v0.3.0

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