public void WriteColourBlock3(Vec3 start, Vec3 end, Byte[] indices) { // get the packed values int a = start.ToPackedInt565(); int b = end.ToPackedInt565(); // remap the indices var remapped = new Byte[16]; if (a <= b) { // use the indices directly for (int i = 0; i < 16; ++i) { remapped[i] = indices[i]; } } else { // swap a and b var c = a; a = b; b = c; for (int i = 0; i < 16; ++i) { if (indices[i] == 0) { remapped[i] = 1; } else if (indices[i] == 1) { remapped[i] = 0; } else { remapped[i] = indices[i]; } } } // write the block WriteColourBlock(a, b, remapped); }