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 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 slice of the entities (items, mobs) within the chunk.
Entities() []gamerules.INonPlayerEntity
// Return a slice of the tile entities (chests, furnaces, etc.) within the
// chunk.
TileEntities() []gamerules.ITileEntity
// 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 error)
SupportsWrite() bool
Writer() IChunkWriter
WriteChunk(writer IChunkWriter) error
}
func ChunkStoreForLevel ¶
func ChunkStoreForLevel(worldPath string, levelData nbt.ITag, dimension DimensionId) (store IChunkStoreForeground, err error)
Given the NamedTag for a level.dat, returns an appropriate IChunkStoreForeground.
type IChunkWriter ¶
type IChunkWriter interface {
// ChunkLoc returns the chunk location.
ChunkLoc() ChunkXz
// SetChunkLoc sets the chunk location.
SetChunkLoc(loc ChunkXz)
// SetBlocks sets the block IDs in the chunk.
SetBlocks(blocks []byte)
// SetBlockData sets the block data in the chunk.
SetBlockData(blockData []byte)
// SetBlockLight sets the block light data in the chunk.
SetBlockLight(blockLight []byte)
// SetSkyLight sets the sky light data in the chunk.
SetSkyLight(skyLight []byte)
// SetHeightMap sets the height map data in the chunk.
SetHeightMap(heightMap []byte)
// SetEntities sets a list of the entities (items, mobs) within the chunk.
SetEntities(entities map[EntityId]gamerules.INonPlayerEntity)
// SetTileEntities sets a list of the tile entities (chests, furnaces, etc.)
// within the chunk.
SetTileEntities(tileEntities map[BlockIndex]gamerules.ITileEntity)
}
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 error)
func (*MultiStore) SupportsWrite ¶
func (s *MultiStore) SupportsWrite() bool
func (*MultiStore) WriteChunk ¶
func (s *MultiStore) WriteChunk(writer IChunkWriter) error
func (*MultiStore) Writer ¶
func (s *MultiStore) Writer() IChunkWriter
type NoSuchChunkError ¶
type NoSuchChunkError bool
func (NoSuchChunkError) Error ¶
func (err NoSuchChunkError) Error() string
type UnknownLevelVersion ¶
type UnknownLevelVersion int32
func (UnknownLevelVersion) Error ¶
func (err UnknownLevelVersion) Error() string