Structure is a library for Dragonfly implementing support for reading and writing Minecraft Bedrock Edition structures.
Structure requires at least Go 1.18. The library may be installed using:
go get github.com/df-mc/structure
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)
}