Documentation
¶
Index ¶
Constants ¶
const DataVersion = 4189
DataVersion for Minecraft 1.21.10
Variables ¶
This section is empty.
Functions ¶
func ChunkToNBT ¶
ChunkToNBT converts a world.Chunk into the Anvil NBT compound format.
func NBTToChunk ¶
NBTToChunk converts Anvil NBT data into a world.Chunk.
Types ¶
type AnvilStorage ¶
type AnvilStorage struct {
// contains filtered or unexported fields
}
AnvilStorage implements world.Storage using the Anvil region file format. Region files are cached in memory and flushed on Close.
func NewAnvilStorage ¶
func NewAnvilStorage(dir string, reg *world.BlockStateRegistry) (*AnvilStorage, error)
NewAnvilStorage creates an AnvilStorage backed by the given directory. The directory will be created if it does not exist.
func (*AnvilStorage) Close ¶
func (s *AnvilStorage) Close() error
Close closes all open region files.
func (*AnvilStorage) LoadChunk ¶
func (s *AnvilStorage) LoadChunk(pos world.ChunkPos) (*world.Chunk, error)
LoadChunk reads a chunk from the Anvil region files.
func (*AnvilStorage) SaveChunk ¶
func (s *AnvilStorage) SaveChunk(pos world.ChunkPos, chunk *world.Chunk) error
SaveChunk writes a chunk to the Anvil region files.
type RegionFile ¶
type RegionFile struct {
// contains filtered or unexported fields
}
RegionFile manages a single .mca region file. It provides read/write access to chunks stored in the Anvil format.
func OpenRegion ¶
func OpenRegion(path string) (*RegionFile, error)
OpenRegion opens an existing region file or creates a new one.
func (*RegionFile) HasChunk ¶
func (rf *RegionFile) HasChunk(localX, localZ int) bool
HasChunk reports whether a chunk exists in this region.
func (*RegionFile) ReadChunkNBT ¶
func (rf *RegionFile) ReadChunkNBT(localX, localZ int) (nbt.Tag, error)
ReadChunkNBT reads and decompresses a chunk's NBT data.
func (*RegionFile) WriteChunkNBT ¶
func (rf *RegionFile) WriteChunkNBT(localX, localZ int, tag nbt.Tag) error
WriteChunkNBT compresses and writes chunk NBT data to the region file.