testing

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func In

func In(cx, cy int) (int, int)

In calculate chunk's coordinates relative to region

Types

type Column

type Column struct {
	DataVersion int32                    `nbt:"DataVersion"`
	XPos        int32                    `nbt:"xPos"`
	YPos        int32                    `nbt:"yPos"`
	ZPos        int32                    `nbt:"zPos"`
	Lights      [][]int16                `nbt:"Lights,omitempty"`
	Entities    []map[string]interface{} `nbt:"entities,omitempty"`
	Heightmaps  struct {
		MOTIONBLOCKING         []int64 `nbt:"MOTION_BLOCKING"`
		MOTIONBLOCKINGNOLEAVES []int64 `nbt:"MOTION_BLOCKING_NO_LEAVES"`
		OCEANFLOOR             []int64 `nbt:"OCEAN_FLOOR"`
		OCEANFLOORWG           []int64 `nbt:"OCEAN_FLOOR_WG"`
		WORLDSURFACE           []int64 `nbt:"WORLD_SURFACE"`
		WORLDSURFACEWG         []int64 `nbt:"WORLD_SURFACE_WG"`
	} `nbt:"Heightmaps"`
	InhabitedTime  int64           `nbt:"InhabitedTime"`
	LastUpdate     int64           `nbt:"LastUpdate"`
	PostProcessing [][]interface{} `nbt:"PostProcessing"`
	Status         string          `nbt:"Status"`
	BlockEntities  []interface{}   `nbt:"block_entities"`
	BlockTicks     []interface{}   `nbt:"block_ticks"`
	FluidTicks     []interface{}   `nbt:"fluid_ticks"`
	IsLightOn      byte            `nbt:"isLightOn"`
	Sections       []Section       `nbt:"sections"`
	CarvingMasks   struct {
		Air    []int64 `nbt:"AIR"`
		Liquid []int64 `nbt:"LIQUID"`
	} `nbt:"CarvingMasks"`
	StarlightLightVersion int32 `nbt:"starlight.light_version"`
	Structures            struct {
		References map[string]interface{} `nbt:"References"`
		Starts     map[string]interface{} `nbt:"starts"`
	} `nbt:"structures"`
}

func (*Column) Load

func (c *Column) Load(data []byte) (err error)

Load read column data from []byte

type PaletteEntry

type PaletteEntry struct {
	Name       string                 `nbt:"Name"`
	Properties map[string]interface{} `nbt:"Properties,omitempty"`
}

type Region

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

Region contain 32*32 chunks in one .mca file

func Create

func Create(name string) (r *Region, err error)

Create open .mca file with os.O_CREATE|os. O_EXCL, and init the region

func LoadRegion

func LoadRegion(f io.ReadWriteSeeker) (r *Region, err error)

Load works like Open but read from an io.ReadWriteSeeker.

func OpenRegion

func OpenRegion(name string) (r *Region, err error)

Open a .mca file and read the head. Close the Region after used.

func (*Region) Close

func (r *Region) Close() error

Close the region file if possible. The responsibility for Close the file with who Open it. If you made the Region with Load(), this method close the file only if your io.ReadWriteSeeker implement io.Close

func (*Region) ExistSector

func (r *Region) ExistSector(x, y int) bool

ExistSector return if a sector is exist

func (*Region) ReadSector

func (r *Region) ReadSector(x, y int) (data []byte, err error)

ReadSector find and read the Chunk data from region

func (*Region) WriteSector

func (r *Region) WriteSector(x, y int, data []byte) error

WriteSector write Chunk data into region file

type Section

type Section struct {
	Y                        byte  `nbt:"Y"`
	StarlightBlocklightState int32 `nbt:"starlight.blocklight_state,omitempty"`
	StarlightSkylightState   int32 `nbt:"starlight.skylight_state,omitempty"`
	Biomes                   struct {
		Data    []int64  `nbt:"data"`
		Palette []string `nbt:"palette"`
	} `nbt:"biomes,omitempty"`
	BlockStates struct {
		Data    []int64        `nbt:"data"`
		Palette []PaletteEntry `nbt:"palette"`
	} `nbt:"block_states,omitempty"`
	BlockLight []byte `nbt:"BlockLight,omitempty"`
	SkyLight   []byte `nbt:"SkyLight,omitempty"`
}

Jump to

Keyboard shortcuts

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