Table of Contents

Class ColumnBytePalette

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

A per-column palette of one value per (x,z) cell over a 32×32 column (Java: IntBytePalette for tints, ShortBytePalette for heights). Distinct values are interned into a key table and each of the 1024 cells stores a 10-bit index into it (via BitFieldArray). Cell 0 defaults to key 0.

The wire format is [u16 count][count × key][i32 packedByteLength][packed indices], little-endian, with no leading type byte — height and tint are told apart by their position in SetColumn. The key width is the only difference between the two: SerializeShortKeys() (heights) vs SerializeIntKeys() (tints).

public sealed class ColumnBytePalette
Inheritance
ColumnBytePalette
Inherited Members

Fields

BitsPerIndex

public const int BitsPerIndex = 10

Field Value

int

CellCount

public const int CellCount = 1024

Field Value

int

Edge

public const int Edge = 32

Field Value

int

Methods

CellIndex(int, int)

Column cell index for (x,z): z<<5 | x, range 0..1023.

public static int CellIndex(int x, int z)

Parameters

x int
z int

Returns

int

Get(int, int)

The value at column cell (x,z).

public int Get(int x, int z)

Parameters

x int
z int

Returns

int

SerializeIntKeys()

Serialize with 32-bit LE keys (tints).

public byte[] SerializeIntKeys()

Returns

byte[]

SerializeShortKeys()

Serialize with 16-bit LE keys (heights).

public byte[] SerializeShortKeys()

Returns

byte[]

Set(int, int, int)

Set the value at column cell (x,z), interning it into the key table.

public void Set(int x, int z, int value)

Parameters

x int
z int
value int