Documentation ¶
Index ¶
- type Provider
- func (p *Provider) Close() error
- func (p *Provider) LoadBlockNBT(position world.ChunkPos) ([]map[string]interface{}, error)
- func (p *Provider) LoadChunk(position world.ChunkPos) (c *chunk.Chunk, exists bool, err error)
- func (p *Provider) LoadDefaultGameMode() world.GameMode
- func (p *Provider) LoadDifficulty() world.Difficulty
- func (p *Provider) LoadEntities(world.ChunkPos) ([]world.Entity, error)
- func (p *Provider) SaveBlockNBT(position world.ChunkPos, data []map[string]interface{}) error
- func (p *Provider) SaveChunk(position world.ChunkPos, c *chunk.Chunk) error
- func (p *Provider) SaveDefaultGameMode(mode world.GameMode)
- func (p *Provider) SaveDifficulty(d world.Difficulty)
- func (p *Provider) SaveEntities(world.ChunkPos, []world.Entity) error
- func (p *Provider) SaveSettings(s world.Settings)
- func (p *Provider) Settings() world.Settings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider implements a world provider for the Minecraft world format, which is based on a leveldb database.
func New ¶
New creates a new provider reading and writing files to files under the path passed. If a world is present at the path, New will parse its data and initialise the world with it. If the data cannot be parsed, an error is returned.
func (*Provider) Close ¶
Close closes the provider, saving any file that might need to be saved, such as the level.dat.
func (*Provider) LoadBlockNBT ¶
LoadBlockNBT loads all block entities from the chunk position passed.
func (*Provider) LoadChunk ¶
LoadChunk loads a chunk at the position passed from the leveldb database. If it doesn't exist, exists is false. If an error is returned, exists is always assumed to be true.
func (*Provider) LoadDefaultGameMode ¶
LoadDefaultGameMode returns the default game mode stored in the level.dat.
func (*Provider) LoadDifficulty ¶
func (p *Provider) LoadDifficulty() world.Difficulty
LoadDifficulty loads the difficulty stored in the level.dat.
func (*Provider) LoadEntities ¶
LoadEntities loads all entities from the chunk position passed.
func (*Provider) SaveBlockNBT ¶
SaveBlockNBT saves all block NBT data to the chunk position passed.
func (*Provider) SaveChunk ¶
SaveChunk saves a chunk at the position passed to the leveldb database. Its version is written as the version in the chunkVersion constant.
func (*Provider) SaveDefaultGameMode ¶
SaveDefaultGameMode changes the default game mode in the level.dat.
func (*Provider) SaveDifficulty ¶
func (p *Provider) SaveDifficulty(d world.Difficulty)
SaveDifficulty saves the difficulty passed to the level.dat.
func (*Provider) SaveEntities ¶
SaveEntities saves all entities to the chunk position passed.
func (*Provider) SaveSettings ¶ added in v0.1.0
SaveSettings saves the world.Settings passed to the level.dat.