public Section(byte y) { const int size = Width * Height * Depth; this.Y = y; Blocks = new byte[size]; Metadata = new NibbleArray(size); BlockLight = new NibbleArray(size); SkyLight = new NibbleArray(size); for (int i = 0; i < size; i++) SkyLight[i] = 0xFF; Add = null; // Only used when needed nonAirCount = 0; }
public Section(byte y) { const int size = Width * Height * Depth; this.Y = y; Blocks = new byte[size]; Metadata = new NibbleArray(size); BlockLight = new NibbleArray(size); SkyLight = new NibbleArray(size); for (int i = 0; i < size; i++) { SkyLight[i] = 0xFF; } Add = null; // Only used when needed nonAirCount = 0; }
public ReadOnlyNibbleArray(NibbleArray array) { NibbleArray = array; }
public void SetBlockId(Coordinates3D coordinates, short value) { int index = coordinates.X + (coordinates.Z * Width) + (coordinates.Y * Height * Width); if (value == 0) { if (Blocks[index] != 0) nonAirCount--; } else { if (Blocks[index] == 0) nonAirCount++; } Blocks[index] = (byte)value; if ((value & ~0xFF) != 0) { if (Add == null) Add = new NibbleArray(Width * Height * Depth); Add[index] = (byte)((ushort)value >> 8); } }