chunk

package
v0.0.0-...-f33b5a6 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2020 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// height in blocks of a chunk column
	ChunkHeight = 256

	// width in blocks of a chunk column
	ChunkWidth = 16

	// height in blocks of a chunk section
	SectionHeight = 16

	// width in blocks of a chunk section
	SectionWidth = 16

	// volume in blocks of a chunk section
	SectionVolume = SectionHeight * SectionWidth * SectionWidth

	// number of chunk sections in a chunk column
	NumSections = 16

	// number of light sections in a chunk column
	NumLightSections = NumSections + 2

	// number of elements in the light byte array
	LightVolume = (SectionHeight * SectionWidth * SectionWidth) / 2

	// maximum number of bits per block allowed when using the section palette.
	// values above will switch to global palette
	MaxBitsPerBlock = 8

	// number of bits used for each block in the global palette.
	// this value should not be hardcoded according to wiki.vg
	GlobalBitsPerBlock = 14
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Chunk

type Chunk struct {
	X, Z int
	// contains filtered or unexported fields
}

func NewChunk

func NewChunk(x, z int) *Chunk

func (*Chunk) GetBlockLight

func (c *Chunk) GetBlockLight(x, y, z int) int

func (*Chunk) GetBlockState

func (c *Chunk) GetBlockState(x, y, z int) uint16

func (*Chunk) GetSkyLight

func (c *Chunk) GetSkyLight(x, y, z int) int

func (*Chunk) MakeChunkDataPacket

func (c *Chunk) MakeChunkDataPacket(writer *minecraft.Writer)

Write the chunk data into the given writer in the Chunk Data format

NOTE: This does not include block entities! these are managed by the world

so they need to be written by the world as well!

func (*Chunk) MakeUpdateLightPacket

func (c *Chunk) MakeUpdateLightPacket(writer *minecraft.Writer)

TODO: maybe cache this

func (*Chunk) SetBlockLight

func (c *Chunk) SetBlockLight(x, y, z int, light int)

func (*Chunk) SetBlockState

func (c *Chunk) SetBlockState(x, y, z int, state uint16)

func (*Chunk) SetSkyLight

func (c *Chunk) SetSkyLight(x, y, z int, light int)

Jump to

Keyboard shortcuts

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