world

package
v0.0.0-...-93368d4 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2015 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	None = iota
	Gzip
	Zlib
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Chunk

type Chunk struct {
	X                int32        `xPos`             // X position of the chunk
	Z                int32        `zPos`             // Z position of the chunk
	LastUpdate       int64        `LastUpdate`       // Tick when the chunk was last saved.
	TerrainPopulated bool         `TerrainPopulated` // false=NMC resets world.
	Biomes           [256]byte    `Biomes`           // -1=NMC reset biome.
	HeightMap        [256]int32   `HeightMap`        // Lowest Y light is at full strength. ZX.
	Sections         [16]*Section `Sections`         // 16x16x16 blocks.
	Entities         []Entity     `Entities`         // List of NBT Compound.
	TileEntities     []TileEntity `TileEntities`     // List of NBT Compound.
	TileTicks        []TileTick   `TileTicks`        // List of NBT Compound.
}

Chunk

Note: All fields are children of root's compound tag named "Level".

func (*Chunk) ReadFrom

func (c *Chunk) ReadFrom(r io.Reader) (n int64, err error)

func (*Chunk) WriteTo

func (c *Chunk) WriteTo(w io.Writer) (n int64, err error)

type Entity

type Entity struct {
	Id             string  // Entity ID. Doesn't exist for players.
	X, Y, Z        float64 // Pos.
	Dx, Dy, Dz     float64 // Velocity. Unit: meters per tick.
	Yaw, Pitch     float32 // Look. Unit: degrees.
	FallDistance   float32 // Distance the entity has fallen.
	Fire           int16   // Fire ticks left or inmune ticks iff Fire < 0.
	Air            int16   // Air ticks left. Max: 200 (10s). Decreases under water.
	OnGround       bool    // Captain Obvious!
	Dimension      int32   // Unknown usage.
	Invulnerable   bool    // Applies to living/nonliving entities.
	PortalCooldown int32   // Starts at 900 ticks (45s) and decrements.
	UUIDLeast      int64   // Unused.
	UUIDMost       int64   // Unused.
	Riding         *Entity // Entity being ridden. Recursive.
}

func (*Entity) ReadFrom

func (e *Entity) ReadFrom(r io.Reader) (n int64, err error)

func (*Entity) WriteTo

func (e *Entity) WriteTo(w io.Writer) (n int64, err error)

type Region

type Region struct {
	Pos  [1024]int32 // Chunk position in 4k increments from start.
	Mod  [1024]int32 // Last modification time of a chunk
	Data [1024]struct {
		Length int32
		Chunk  []byte
	}
}

Region (.mca files) store 32x32 chunks.

func (*Region) ChunkPos

func (re *Region) ChunkPos(x, z int32) int

func (*Region) ReadFrom

func (re *Region) ReadFrom(r io.Reader) (n int64, err error)

func (*Region) WriteTo

func (re *Region) WriteTo(w io.Writer) (n int64, err error)

type Section

type Section struct {
	Y          byte       // Y section index. 0~15 bottom to top.
	Blocks     [4096]byte // 8b/block. YZX.
	Add        [2048]byte // 4b/block. YZX. Add << 8 | Blocks
	Data       [2048]byte // 4b/block. YZX.
	BlockLight [2048]byte // 4b/block. YZX.
	SkyLight   [2048]byte // 4b/block. YZX.
}

Section holds the 1/16 part of a chunk (16x16x16).

func (*Section) ReadFrom

func (s *Section) ReadFrom(r io.Reader) (n int64, err error)

func (*Section) WriteTo

func (s *Section) WriteTo(w io.Writer) (n int64, err error)

type TileEntity

type TileEntity struct {
	Id      string // Tile entity Id.
	X, Y, Z int32  // Pos.
}

func (*TileEntity) ReadFrom

func (te *TileEntity) ReadFrom(r io.Reader) (n int64, err error)

func (*TileEntity) WriteTo

func (te *TileEntity) WriteTo(w io.Writer) (n int64, err error)

type TileTick

type TileTick struct {
	Id      int32 // Block Id.
	Ticks   int32 // Ticks until processing. Iff Ticks < 0: overdue.
	X, Y, Z int32 // Pos.
}

func (*TileTick) ReadFrom

func (tt *TileTick) ReadFrom(r io.Reader) (n int64, err error)

func (*TileTick) WriteTo

func (tt *TileTick) WriteTo(w io.Writer) (n int64, err error)

Jump to

Keyboard shortcuts

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