Skip to content
/ level Public

[WIP] A level library for minecraft written in Go // I may throw away :P

License

Notifications You must be signed in to change notification settings

beito123/level

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

level

[WIP] I may throw away :P

Installation

You can get the package with go get command.

go get -u github.com/beito123/level

-u is a option updating the package

License

This is licensed by MIT License. See LICENSE file.

Examples

Read

func main() {
	// Load leveldb level for mcbe
	lvl, err := leveldb.Load("./db")
	if err != nil {
		panic(err)
	}

	// Chunk coordinates
	x := 0
	y := 0

	ok, err := lvl.HasGeneratedChunk(x, y)
	if err != nil {
		panic(err)
	}

	if !ok {
		panic("a chunk isn't generated")
	}

	// Get chunk
	chunk, err := lvl.Chunk(x, y)
	if err != nil {
		panic(err)
	}

	for y := 0; y < 256; y++ {
		for z := 0; z < 16; z++ {
			for x := 0; x < 16; x++ {
				b, err := chunk.GetBlock(x, y, z)
				if err != nil {
					panic(err)
				}

				if b.Name() == "minecraft:air" { // ignore air
					continue
				}

				fmt.Printf("%s (at %d, %d, %d)\n", b.Name(), x, y, z)
			}
		}
	}
}

About

[WIP] A level library for minecraft written in Go // I may throw away :P

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published