Fix X360 Crossplay (#26)

^Reviewed-on: #26

Co-authored-by: qloak <realminecart@gmail.com>
This commit was merged in pull request #26.
This commit is contained in:
2026-08-07 17:14:12 +00:00
committed by pieeebot
parent 92891de261
commit ebbd54288b
41 changed files with 1346 additions and 1287 deletions
@@ -51,17 +51,10 @@ ChunkTilesUpdatePacket::ChunkTilesUpdatePacket(int xc, int zc, shortArray positi
void ChunkTilesUpdatePacket::read(DataInputStream *dis) //throws IOException
{
// 4J - changed format. See comments in write method.
#ifdef _LARGE_WORLDS
xc = dis->readShort();
zc = dis->readShort();
xc = ( xc << 16 ) >> 16;
zc = ( zc << 16 ) >> 16;
#else
xc = dis->read();
zc = dis->read();
xc = ( xc << 24 ) >> 24;
zc = ( zc << 24 ) >> 24;
#endif
int countAndFlags = dis->readByte();
bool dataAllZero = (( countAndFlags & 0x80 ) == 0x80 );
@@ -97,13 +90,8 @@ void ChunkTilesUpdatePacket::read(DataInputStream *dis) //throws IOException
void ChunkTilesUpdatePacket::write(DataOutputStream *dos) //throws IOException
{
// 4J - changed format to reduce size of these packets.
#ifdef _LARGE_WORLDS
dos->writeShort(xc);
dos->writeShort(zc);
#else
dos->write(xc);
dos->write(zc);
#endif
// Determine if we've got any data elements that are non-zero - a large % of these packets set all data to zero, so we don't
// bother sending all those zeros in that case.
bool dataAllZero = true;