Skip to content

Structure parsing and writing library for Dragonfly

Notifications You must be signed in to change notification settings

df-mc/structure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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