Use BYTE Win Typedef instead of byte typedef from Minecraft.World

"byte" wasnt working anymore for some reason
This commit is contained in:
GabsPuNs
2026-04-13 17:54:28 -04:00
parent e90e585ef0
commit 40d48948ff
233 changed files with 4751 additions and 930 deletions

View File

@@ -162,7 +162,7 @@ void SparseDataStorage::setData(byteArray dataIn, unsigned int inOffset)
//int shift = 4 * part;
const unsigned char *pucIn = &dataIn[ (y >> 1) + inOffset];
for( int xz = 0; xz < 128; xz++ ) // 128 ( 16 x 16 x 0.5 ) in loop as packing 2 values into each destination byte
for( int xz = 0; xz < 128; xz++ ) // 128 ( 16 x 16 x 0.5 ) in loop as packing 2 values into each destination BYTE
{
*pucOut = ( ( *pucIn ) >> ( part * 4 ) ) & 15;
pucIn += 64;
@@ -209,7 +209,7 @@ void SparseDataStorage::getData(byteArray retArray, unsigned int retOffset)
const int shift = 4 * part;
unsigned char *pucOut = &retArray.data[ (y >> 1) + + retOffset];
const unsigned char *pucIn = &data[ planeIndices[ y ] * 128 ];
for( int xz = 0; xz < 128; xz++ ) // 128 in loop (16 x 16 x 0.5) as input data is being treated in pairs of nybbles that are packed in the same byte
for( int xz = 0; xz < 128; xz++ ) // 128 in loop (16 x 16 x 0.5) as input data is being treated in pairs of nybbles that are packed in the same BYTE
{
unsigned char value = (*pucIn) & 15;
*pucOut |= ( value << shift );
@@ -238,8 +238,8 @@ int SparseDataStorage::get(int x, int y, int z)
else
{
const int planeIndex = x * 16 + z; // Index within this xz plane
const int byteIndex = planeIndex / 2; // Byte index within the plane (2 tiles stored per byte)
const int shift = ( planeIndex & 1 ) * 4; // Bit shift within the byte
const int byteIndex = planeIndex / 2; // Byte index within the plane (2 tiles stored per BYTE)
const int shift = ( planeIndex & 1 ) * 4; // Bit shift within the BYTE
const int retval = ( data[ planeIndices[y] * 128 + byteIndex ] >> shift ) & 15;
return retval;
@@ -271,8 +271,8 @@ void SparseDataStorage::set(int x, int y, int z, int val)
// Either data was already allocated, or we've just done that. Now store our value into the right place.
const int planeIndex = x * 16 + z; // Index within this xz plane
const int byteIndex = planeIndex / 2; // Byte index within the plane (2 tiles stored per byte)
const int shift = ( planeIndex & 1 ) * 4; // Bit shift within the byte
const int byteIndex = planeIndex / 2; // Byte index within the plane (2 tiles stored per BYTE)
const int shift = ( planeIndex & 1 ) * 4; // Bit shift within the BYTE
const int mask = 0xf0 >> shift;
const int idx = planeIndices[y] * 128 + byteIndex;