Table of Contents

Interface IChunkData

Namespace
Shard.Gameplay.Universe.World.Chunks
Assembly
Shard.Gameplay.Universe.dll

A 32x32x32 volume of int values representing block states.

public interface IChunkData

Fields

AxisLength

The size of a chunk along each axis, in blocks.

public const int AxisLength = 32

Field Value

int

BitsPerAxis

The number of bits needed to hold a chunk-relative block coordinate for a single axis.

public const int BitsPerAxis = 5

Field Value

int

Volume

The volume of a chunk, in blocks. This serves as the upper limit (exclusive) for block indices.

public const int Volume = 32768

Field Value

int

Properties

IsEmpty

Whether all values are zero.

bool IsEmpty { get; }

Property Value

bool

this[BlockIndex]

Gets or sets a block's value by its index.

int this[BlockIndex i] { get; set; }

Parameters

i BlockIndex

Property Value

int

Exceptions

IndexOutOfRangeException

If i is < 0 or >= Volume.

Methods

Clear()

Resets all values to zero.

void Clear()

GetAndSet(BlockIndex, int)

Sets a block's value by its index and returns its previous value.

int GetAndSet(BlockIndex i, int value)

Parameters

i BlockIndex

The block's index.

value int

The new value.

Returns

int

The previous value.

Exceptions

IndexOutOfRangeException

If i is < 0 or >= Volume.