chunkstore

package
v0.0.0-...-566b5d1 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2011 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChunkReadResult

type ChunkReadResult struct {
	Reader IChunkReader
	Err    os.Error
}

type ChunkService

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

ChunkService adapts an IChunkStoreForeground (which can only be accessed from one goroutine) to an IChunkStore.

func NewChunkService

func NewChunkService(store IChunkStoreForeground) (s *ChunkService)

func (*ChunkService) ReadChunk

func (s *ChunkService) ReadChunk(chunkLoc ChunkXz) <-chan ChunkReadResult

func (*ChunkService) Serve

func (s *ChunkService) Serve()

func (*ChunkService) SupportsWrite

func (s *ChunkService) SupportsWrite() bool

func (*ChunkService) WriteChunk

func (s *ChunkService) WriteChunk(writer IChunkWriter)

func (*ChunkService) Writer

func (s *ChunkService) Writer() IChunkWriter

type IChunkReader

type IChunkReader interface {
	// Returns the chunk location.
	ChunkLoc() ChunkXz

	// Returns the block IDs in the chunk.
	Blocks() []byte

	// Returns the block data in the chunk.
	BlockData() []byte

	// Returns the block light data in the chunk.
	BlockLight() []byte

	// Returns the sky light data in the chunk.
	SkyLight() []byte

	// Returns the height map data in the chunk.
	HeightMap() []byte

	// Return a list of the entities (items, mobs) within the chunk.
	Entities() []gamerules.INonPlayerEntity

	// For low-level NBT access. Not for regular use. It's possible that this
	// might return nil if the underlying system doesn't use NBT.
	RootTag() nbt.ITag
}

type IChunkStore

type IChunkStore interface {
	// Serve() serves requests in the foreground.
	Serve()

	ReadChunk(chunkLoc ChunkXz) (result <-chan ChunkReadResult)
	SupportsWrite() bool
	Writer() IChunkWriter

	// Submits the set chunk data for writing. The chunk writer must not be
	// altered any further after calling this.
	WriteChunk(writer IChunkWriter)
}

type IChunkStoreForeground

type IChunkStoreForeground interface {
	ReadChunk(chunkLoc ChunkXz) (reader IChunkReader, err os.Error)
	SupportsWrite() bool
	Writer() IChunkWriter
	WriteChunk(writer IChunkWriter) os.Error
}

func ChunkStoreForLevel

func ChunkStoreForLevel(worldPath string, levelData nbt.ITag, dimension DimensionId) (store IChunkStoreForeground, err os.Error)

Given the NamedTag for a level.dat, returns an appropriate IChunkStoreForeground.

type IChunkWriter

type IChunkWriter interface {
	// Returns the chunk location.
	ChunkLoc() ChunkXz

	// Sets the chunk location.
	SetChunkLoc(loc ChunkXz)

	// Sets the block IDs in the chunk.
	SetBlocks(blocks []byte)

	// Sets the block data in the chunk.
	SetBlockData(blockData []byte)

	// Sets the block light data in the chunk.
	SetBlockLight(blockLight []byte)

	// Sets the sky light data in the chunk.
	SetSkyLight(skyLight []byte)

	// Sets the height map data in the chunk.
	SetHeightMap(heightMap []byte)

	// Sets a list of the entities (items, mobs) within the chunk.
	SetEntities(entities map[EntityId]gamerules.INonPlayerEntity)
}

IChunkWriter is the interface for objects that accept chunk data and write it. These are created by IChunkWriteableStore for use by a chunk to store a snapshot of its current state into. The Set* functions make copies of the data passed in, so that the original data structures passed in can be modified upon return.

type MultiStore

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

MultiStore provides the ability to load a chunk from one or more potential sources of chunk data. The primary purpose of this is to read from a persistant store first, then fall back to generating a chunk if the persistant store does not have it. MultiStore implements IChunkStore.

func NewMultiStore

func NewMultiStore(readStores []IChunkStore, writeStore IChunkStore) *MultiStore

func (*MultiStore) ReadChunk

func (s *MultiStore) ReadChunk(chunkLoc ChunkXz) (reader IChunkReader, err os.Error)

func (*MultiStore) SupportsWrite

func (s *MultiStore) SupportsWrite() bool

func (*MultiStore) WriteChunk

func (s *MultiStore) WriteChunk(writer IChunkWriter) os.Error

func (*MultiStore) Writer

func (s *MultiStore) Writer() IChunkWriter

type NoSuchChunkError

type NoSuchChunkError bool

func (NoSuchChunkError) String

func (err NoSuchChunkError) String() string

type UnknownLevelVersion

type UnknownLevelVersion int32

func (UnknownLevelVersion) String

func (err UnknownLevelVersion) String() string

Jump to

Keyboard shortcuts

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