anvil

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2020 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidColumnCoords = errors.New("specified column coordinates are invalid, check region file is correct")
View Source
var ErrInvalidColumnSize = errors.New("column exact size is greater than maximum column size specified in region header")
View Source
var ErrOffsetOutOfBounds = errors.New("column location offset is out of bounds")

Functions

This section is empty.

Types

type Chunk

type Chunk struct {
	Y       byte `nbt:"Y"`
	Palette []struct {
		Name string `nbt:"Name"`
	} `nbt:"Palette"`
	BlockLight  []byte  `nbt:"BlockLight"`
	BlockStates []int64 `nbt:"BlockStates"`
	SkyLight    []byte  `nbt:"SkyLight"`
}

Chunk represents a world section of 16x16x16 blocks

func (Chunk) Block

func (c Chunk) Block(x, y, z int) (id string, err error)

Block returns the id of the block at (x, y, z) **in chunk coordinates**

type Column

type Column struct {
	XPos     int32   `nbt:"xPos"`
	ZPos     int32   `nbt:"zPos"`
	Sections []Chunk `nbt:"Sections"`
}

Column represents a world section composed by 1x16x1 chunks

func (Column) Chunk

func (c Column) Chunk(y byte) (chunk Chunk, err error)

Chunk returns the Chunk at height y (0 to 15) in the chunk column

type ColumnLocation

type ColumnLocation []byte

func (ColumnLocation) ColumnOffset

func (cl ColumnLocation) ColumnOffset() (offset uint)

func (ColumnLocation) ColumnSize

func (cl ColumnLocation) ColumnSize() (size uint)

type Dimension

type Dimension struct {
	// contains filtered or unexported fields
}

Dimension is a collection of region files. It's so called because minecraft stores dimensions in separate folders.

func OpenDimension

func OpenDimension(regionDir string) *Dimension

OpenDimension returns a new Dimension with regionDir as the base directory for region files

func (*Dimension) Block

func (d *Dimension) Block(x, y, z int) (id string, err error)

Block returns the id of the block at (x, y, z) in the dimension

type Region

type Region struct {
	X, Z       int
	Header     RegionHeader
	ColumnData []byte
}

Region represents a section of world composed by 32x1x32 columns

func ParseRegion

func ParseRegion(r io.Reader) (reg Region, err error)

ParseRegion returns a Region decoded from the Reader r, eventually returning an error.

func (*Region) Column

func (reg *Region) Column(x, z int) (c Column, err error)

Column returns the column at (x,z)

type RegionHeader

type RegionHeader []byte

func (RegionHeader) GetColumnLocation

func (rh RegionHeader) GetColumnLocation(x, z int) (c ColumnLocation, err error)

GetColumnLocation returns the location of the column at (x,z)

Jump to

Keyboard shortcuts

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