Documentation
¶
Index ¶
- Constants
- Variables
- func EncodeBiomes(c *Chunk, e Encoding) []byte
- func EncodeSubChunk(c *Chunk, e Encoding, ind int) []byte
- func LightArea(c []*Chunk, baseX, baseZ int) *lightArea
- type BlockEntity
- type BlockPaletteEncoding
- type BlockRegistry
- type Chunk
- func DiskDecode(br BlockRegistry, data SerialisedData, r cube.Range) (*Chunk, error)
- func NetworkDecode(br BlockRegistry, data []byte, count int, r cube.Range) (*Chunk, error)
- func NetworkDecodeBuffer(br BlockRegistry, buf *bytes.Buffer, count int, r cube.Range) (*Chunk, error)
- func New(br BlockRegistry, r cube.Range) *Chunk
- func (chunk *Chunk) Biome(x uint8, y int16, z uint8) uint32
- func (chunk *Chunk) Block(x uint8, y int16, z uint8, layer uint8) uint32
- func (chunk *Chunk) Clone() *Chunk
- func (chunk *Chunk) Compact()
- func (chunk *Chunk) Equals(c *Chunk) bool
- func (chunk *Chunk) HeightMap() HeightMap
- func (chunk *Chunk) HighestBlock(x, z uint8) int16
- func (chunk *Chunk) HighestFilledSubChunk() uint16
- func (chunk *Chunk) HighestLightBlocker(x, z uint8) int16
- func (chunk *Chunk) Light(x uint8, y int16, z uint8) uint8
- func (chunk *Chunk) Range() cube.Range
- func (chunk *Chunk) SetBiome(x uint8, y int16, z uint8, biome uint32)
- func (chunk *Chunk) SetBlock(x uint8, y int16, z uint8, layer uint8, block uint32)
- func (chunk *Chunk) SkyLight(x uint8, y int16, z uint8) uint8
- func (chunk *Chunk) Sub() []*SubChunk
- func (chunk *Chunk) SubChunk(y int16) *SubChunk
- func (chunk *Chunk) SubIndex(y int16) int16
- func (chunk *Chunk) SubY(index int16) int16
- type Column
- type Encoding
- type Entity
- type HeightMap
- type Palette
- type PalettedStorage
- func (storage *PalettedStorage) At(x, y, z byte) uint32
- func (storage *PalettedStorage) Clone() *PalettedStorage
- func (storage *PalettedStorage) Equal(other *PalettedStorage) bool
- func (storage *PalettedStorage) Palette() *Palette
- func (storage *PalettedStorage) PaletteIndex(x, y, z byte) uint16
- func (storage *PalettedStorage) Set(x, y, z byte, v uint32)
- type ScheduledBlockUpdate
- type SerialisedData
- type SubChunk
- func (sub *SubChunk) Block(x, y, z byte, layer uint8) uint32
- func (sub *SubChunk) BlockLight(x, y, z byte) uint8
- func (sub *SubChunk) Clone() *SubChunk
- func (sub *SubChunk) Empty() bool
- func (sub *SubChunk) Equals(s *SubChunk) bool
- func (sub *SubChunk) Layer(layer uint8) *PalettedStorage
- func (sub *SubChunk) Layers() []*PalettedStorage
- func (sub *SubChunk) SetBlock(x, y, z byte, layer uint8, block uint32)
- func (sub *SubChunk) SetBlockLight(x, y, z byte, level uint8)
- func (sub *SubChunk) SetSkyLight(x, y, z byte, level uint8)
- func (sub *SubChunk) SkyLight(x, y, z byte) uint8
Constants ¶
View Source
const ( SubChunkVersion = 9 CurrentBlockVersion int32 = 18040335 )
Variables ¶
View Source
var ( DiskEncoding diskEncoding NetworkEncoding networkEncoding BiomePaletteEncoding biomePaletteEncoding )
View Source
var ( SkyLight skyLight BlockLight blockLight )
Functions ¶
func EncodeBiomes ¶
Types ¶
type BlockPaletteEncoding ¶
type BlockPaletteEncoding struct {
Blocks BlockRegistry
}
func (BlockPaletteEncoding) DecodeBlockState ¶
func (bpe BlockPaletteEncoding) DecodeBlockState(m map[string]any) (uint32, error)
func (BlockPaletteEncoding) EncodeBlockState ¶
func (bpe BlockPaletteEncoding) EncodeBlockState(v uint32) blockEntry
type BlockRegistry ¶
type BlockRegistry interface {
BlockCount() int
AirRuntimeID() uint32
RuntimeIDToState(runtimeID uint32) (name string, properties map[string]any, found bool)
StateToRuntimeID(name string, properties map[string]any) (runtimeID uint32, found bool)
FilteringBlock(rid uint32) uint8
LightBlock(rid uint32) uint8
RandomTickBlock(rid uint32) bool
NBTBlock(rid uint32) bool
LiquidDisplacingBlock(rid uint32) bool
LiquidBlock(rid uint32) bool
HashToRuntimeID(hash uint32) (rid uint32, ok bool)
RuntimeIDToHash(runtimeID uint32) (hash uint32, ok bool)
}
type Chunk ¶
type Chunk struct {
// contains filtered or unexported fields
}
func DiskDecode ¶
func DiskDecode(br BlockRegistry, data SerialisedData, r cube.Range) (*Chunk, error)
func NetworkDecode ¶
func NetworkDecodeBuffer ¶
func (*Chunk) HighestBlock ¶
func (*Chunk) HighestFilledSubChunk ¶
func (*Chunk) HighestLightBlocker ¶
type Column ¶
type Column struct {
Chunk *Chunk
Entities []Entity
BlockEntities []BlockEntity
Tick int64
ScheduledBlocks []ScheduledBlockUpdate
}
type PalettedStorage ¶
type PalettedStorage struct {
// contains filtered or unexported fields
}
func (*PalettedStorage) At ¶
func (storage *PalettedStorage) At(x, y, z byte) uint32
func (*PalettedStorage) Clone ¶
func (storage *PalettedStorage) Clone() *PalettedStorage
func (*PalettedStorage) Equal ¶
func (storage *PalettedStorage) Equal(other *PalettedStorage) bool
func (*PalettedStorage) Palette ¶
func (storage *PalettedStorage) Palette() *Palette
func (*PalettedStorage) PaletteIndex ¶
func (storage *PalettedStorage) PaletteIndex(x, y, z byte) uint16
func (*PalettedStorage) Set ¶
func (storage *PalettedStorage) Set(x, y, z byte, v uint32)
type ScheduledBlockUpdate ¶
type SerialisedData ¶
func Encode ¶
func Encode(c *Chunk, e Encoding) SerialisedData
type SubChunk ¶
type SubChunk struct {
// contains filtered or unexported fields
}
func NewSubChunk ¶
func (*SubChunk) BlockLight ¶
func (*SubChunk) Layer ¶
func (sub *SubChunk) Layer(layer uint8) *PalettedStorage
func (*SubChunk) Layers ¶
func (sub *SubChunk) Layers() []*PalettedStorage
func (*SubChunk) SetBlockLight ¶
func (*SubChunk) SetSkyLight ¶
Click to show internal directories.
Click to hide internal directories.