diff --git a/src/voxels/voxel.hpp b/src/voxels/voxel.hpp index 0e19415f..460a6a4f 100644 --- a/src/voxels/voxel.hpp +++ b/src/voxels/voxel.hpp @@ -12,8 +12,8 @@ inline constexpr int BLOCK_DIR_DOWN = 0x5; struct blockstate { uint8_t rotation : 3; // block rotation index - uint8_t segment : 1; // segment block bit - uint8_t reserved : 4; // reserved bits + uint8_t segment : 3; // segment block bits + uint8_t reserved : 2; // reserved bits uint8_t userbits : 8; // bits for use in block script }; static_assert (sizeof(blockstate) == 2); @@ -22,7 +22,7 @@ static_assert (sizeof(blockstate) == 2); inline constexpr blockstate_t blockstate2int(blockstate b) { return static_cast(b.rotation) | static_cast(b.segment) << 3 | - static_cast(b.reserved) << 4 | + static_cast(b.reserved) << 6 | static_cast(b.userbits) << 8; } @@ -30,8 +30,8 @@ inline constexpr blockstate_t blockstate2int(blockstate b) { inline constexpr blockstate int2blockstate(blockstate_t i) { return { static_cast(i & 0b111), - static_cast((i >> 3) & 0b1), - static_cast((i >> 4) & 0b1111), + static_cast((i >> 3) & 0b111), + static_cast((i >> 6) & 0b11), static_cast((i >> 8) & 0xFF) }; }