fix(linux): more shit

This commit is contained in:
Mohamed Ashraf authored and Anaël committed 2026-11-28 01:58:00 +01:00
1 parent 20278c2856
commit a0a35f3c0b
18 files changed
+267 -80

No files matched your search

+18 -4
View File
@@ -7,7 +7,9 @@
#include "PacketListener.h"
#include "AddGlobalEntityPacket.h"
#if defined(__linux__)
#include <cstddef>
#endif
const int AddGlobalEntityPacket::LIGHTNING = 1;
@@ -20,13 +22,13 @@ AddGlobalEntityPacket::AddGlobalEntityPacket()
type = 0;
}
AddGlobalEntityPacket::AddGlobalEntityPacket(shared_ptr<Entity> e)
AddGlobalEntityPacket::AddGlobalEntityPacket(shared_ptr<Entity> e)
{
id = e->entityId;
x = Mth::floor(e->x * 32);
y = Mth::floor(e->y * 32);
z = Mth::floor(e->z * 32);
if ( e->instanceof(eTYPE_LIGHTNINGBOLT) )
if ( e->instanceof(eTYPE_LIGHTNINGBOLT) )
{
type = LIGHTNING;
}
@@ -39,16 +41,28 @@ AddGlobalEntityPacket::AddGlobalEntityPacket(shared_ptr<Entity> e)
void AddGlobalEntityPacket::read(DataInputStream *dis) // throws IOException
{
id = dis->readInt();
#ifdef _WIN32
type = dis->readByte();
#else
type = std::to_integer<int>(dis->readByte());
#endif
x = dis->readInt();
y = dis->readInt();
z = dis->readInt();
}
void AddGlobalEntityPacket::write(DataOutputStream *dos) // throws IOException
void AddGlobalEntityPacket::write(DataOutputStream *dos) // throws IOException
{
dos->writeInt(id);
#ifdef _WIN32
dos->writeByte(type);
#else
dos->writeByte(static_cast<std::byte>(type));
#endif
dos->writeInt(x);
dos->writeInt(y);
dos->writeInt(z);