A Minecraft datapack generator written in go.
1package structure
2
3import (
4 "os"
5 "path/filepath"
6 "tangled.org/cosmeak.tngl.sh/weave/internal/generator"
7)
8
9// The idea here is just to get the data from the file, the filename
10// and then move all this information to the datapack. Nothing fancy
11// or complicated here.
12func (s Structure) Emit() (generator.File, error) {
13 path := "data/%namespace%/structure/" + filepath.Base(s.filePath)
14
15 content, err := os.ReadFile(s.filePath)
16 if err != nil {
17 return generator.File{}, err
18 }
19
20 return generator.File{
21 Path: path,
22 Content: content,
23 }, nil
24}