mirror of
https://git.neolegacy.dev/neoStudiosLCE/neoLegacy.git
synced 2026-12-02 22:18:09 +01:00
fix(linux): more shit
This commit is contained in:
1 parent
20278c2856
commit
a0a35f3c0b
18 files changed
+267
-80
No files matched your search
@@ -14,8 +14,16 @@ AddMobPacket::AddMobPacket()
|
||||
x = 0;
|
||||
y = 0;
|
||||
z = 0;
|
||||
yRot = 0;
|
||||
|
||||
#ifdef _WIN32
|
||||
yRot = 0;
|
||||
xRot = 0;
|
||||
#else
|
||||
yRot = static_cast<std::byte>(0);
|
||||
xRot = static_cast<std::byte>(0);
|
||||
#endif
|
||||
|
||||
|
||||
entityData = nullptr;
|
||||
unpack = nullptr;
|
||||
}
|
||||
@@ -29,16 +37,29 @@ AddMobPacket::AddMobPacket(shared_ptr<LivingEntity> mob, int yRotp, int xRotp, i
|
||||
{
|
||||
id = mob->entityId;
|
||||
|
||||
type = static_cast<byte>(EntityIO::getId(mob));
|
||||
#ifdef _WIN32
|
||||
type = static_cast<byte>(EntityIO::getId(mob));
|
||||
#else
|
||||
type = static_cast<std::byte>(EntityIO::getId(mob));
|
||||
#endif
|
||||
|
||||
// 4J Stu - We should add entities at their "last sent" position so that the relative update packets
|
||||
// put them in the correct place
|
||||
x = xp;//Mth::floor(mob->x * 32);
|
||||
y = yp;//Mth::floor(mob->y * 32);
|
||||
z = zp;//Mth::floor(mob->z * 32);
|
||||
// 4J - changed - send current "previously sent" value of rotations to put this in sync with other clients
|
||||
yRot = yRotp;
|
||||
|
||||
#ifdef _WIN32
|
||||
yRot = yRotp;
|
||||
xRot = xRotp;
|
||||
yHeadRot = yHeadRotp;
|
||||
#else
|
||||
yRot = static_cast<std::byte>(yRotp);
|
||||
xRot = static_cast<std::byte>(xRotp);
|
||||
yHeadRot = static_cast<std::byte>(yHeadRotp);
|
||||
#endif
|
||||
|
||||
// yRot = (byte) (mob->yRot * 256 / 360);
|
||||
// xRot = (byte) (mob->xRot * 256 / 360);
|
||||
// yHeadRot = (byte) (mob->yHeadRot * 256 / 360);
|
||||
@@ -67,7 +88,12 @@ AddMobPacket::AddMobPacket(shared_ptr<LivingEntity> mob, int yRotp, int xRotp, i
|
||||
void AddMobPacket::read(DataInputStream *dis) //throws IOException
|
||||
{
|
||||
id = dis->readInt();
|
||||
type = dis->readByte() & 0xff;
|
||||
#ifdef _WIN32
|
||||
type = dis->readByte() & 0xff;
|
||||
#else
|
||||
type = std::to_integer<int>(dis->readByte()) & 0xff;
|
||||
#endif
|
||||
|
||||
#ifdef _LARGE_WORLDS
|
||||
x = dis->readInt();
|
||||
y = dis->readInt();
|
||||
@@ -91,7 +117,13 @@ void AddMobPacket::read(DataInputStream *dis) //throws IOException
|
||||
void AddMobPacket::write(DataOutputStream *dos) //throws IOException
|
||||
{
|
||||
dos->writeInt(id);
|
||||
dos->writeByte(type & 0xff);
|
||||
|
||||
#ifdef _WIN32
|
||||
dos->writeByte(type & 0xff);
|
||||
#else
|
||||
dos->writeByte(static_cast<std::byte>(type & 0xff));
|
||||
#endif
|
||||
|
||||
#ifdef _LARGE_WORLDS
|
||||
dos->writeInt(x);
|
||||
dos->writeInt(y);
|
||||
@@ -115,7 +147,7 @@ void AddMobPacket::handle(PacketListener *listener)
|
||||
listener->handleAddMob(shared_from_this());
|
||||
}
|
||||
|
||||
int AddMobPacket::getEstimatedSize()
|
||||
int AddMobPacket::getEstimatedSize()
|
||||
{
|
||||
int size = 11;
|
||||
if( entityData != nullptr )
|
||||
@@ -130,7 +162,7 @@ int AddMobPacket::getEstimatedSize()
|
||||
return size + 2;
|
||||
}
|
||||
|
||||
vector<shared_ptr<SynchedEntityData::DataItem> > *AddMobPacket::getUnpackedData()
|
||||
vector<shared_ptr<SynchedEntityData::DataItem> > *AddMobPacket::getUnpackedData()
|
||||
{
|
||||
if (unpack == nullptr)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user