mcdata

package
v0.0.0-...-1d4e844 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 20, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NumChunkRows = 32
	NumBlockRows = 16
)

Variables

This section is empty.

Functions

func GetLevel

func GetLevel(dataPath string) (*save.Level, error)

GetLevel returns the level data of the given datapath.

This function uses the ${dataPath}/world/level.dat file.

Types

type BlockInfo

type BlockInfo struct {
	ID         string // block id string ex> "minecraft:stone"
	BlockLight uint8  // the amount of block-emitted light
	SkyLight   uint8  // the amount of sunlight or moonlight hitting each block
}

type ChunkInfo

type ChunkInfo struct {
	X      int           // bottom left corner coordinate of region
	Z      int           // bottom left corner coordinate of region
	Blocks [][]BlockInfo // block infos. [x][z], 16*16
}

type PlayerData

type PlayerData struct {
	UUID string
	Name string
	X    float64
	Y    float64
	Z    float64
}

func GetPlayerData

func GetPlayerData(dataPath string) ([]PlayerData, error)

GetPlayerData returns the all player data of the given datapath.

This function uses the ${dataPath}/world/playerdata/*.dat files and ${dataPath}/usercache.json file.

type RegionInfo

type RegionInfo struct {
	RegionX int
	RegionZ int
	Chunks  []*ChunkInfo // chunk infos.
}

RegionInfo covers all 32*32 chunks in a single region file.

func GetRegion

func GetRegion(dataPath string, regionX, regionZ int) (*RegionInfo, error)

Read and parse region data for given x, z.

type RegionPoint

type RegionPoint struct {
	X int
	Z int
}

func GetRegionList

func GetRegionList(dataPath string) ([]RegionPoint, error)

Get all region list in dataPath.

Valid region data file should be located in "world/region" directory and have filename like "r.x.z.mca".

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL