df-mc / structure

Structure parsing and writing library for Dragonfly
4 stars 0 forks source link
df-mc go golang library mcpe minecraft structure

Structure

Structure is a library for Dragonfly implementing support for reading and writing Minecraft Bedrock Edition structures.

Installation

Structure requires at least Go 1.18. The library may be installed using:

go get github.com/df-mc/structure

Usage

Structures may be read (from a file) using the structure.Read and structure.ReadFile functions. These structures may be edited and written afterwards using the structure.Write and structure.WriteFile functions. Alternatively, a new structure can be created using structure.New.

An example of reading and building a structure in a world:

package main

import (
    "github.com/df-mc/dragonfly/server/world"
    "github.com/df-mc/structure"
)

func main() {
    s, err := structure.ReadFile("example.mcstructure")
    if err != nil {
        panic(err)
    }

    var w *world.World
    w.BuildStructure(world.BlockPos{}, s)
}

Documentation

Go Reference

Contact

Discord Banner 2