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

+26 -8
View File
@@ -5,7 +5,7 @@
#include "net.minecraft.world.entity.h"
#include "PacketListener.h"
#include "AddEntityPacket.h"
#include <bitset>
void AddEntityPacket::_init(shared_ptr<Entity> e, int type, int data, int xp, int yp, int zp, int yRotp, int xRotp)
@@ -16,8 +16,15 @@ void AddEntityPacket::_init(shared_ptr<Entity> e, int type, int data, int xp, in
x = xp;//(int) floor(e->x * 32);
y = yp;//(int) floor(e->y * 32);
z = zp;//(int) floor(e->z * 32);
yRot = yRotp;
#ifdef _WIN32
yRot = yRotp;
xRot = xRotp;
#else
yRot = static_cast<std::byte>(yRotp);
xRot = static_cast<std::byte>(xRotp);
#endif
this->type = type;
this->data = data;
if (data > -1) // 4J - changed "no data" value to be -1, we can have a valid entity id of 0
@@ -38,7 +45,7 @@ void AddEntityPacket::_init(shared_ptr<Entity> e, int type, int data, int xp, in
}
}
AddEntityPacket::AddEntityPacket()
AddEntityPacket::AddEntityPacket()
{
}
@@ -47,7 +54,7 @@ AddEntityPacket::AddEntityPacket(shared_ptr<Entity> e, int type, int yRotp, int
_init(e, type, -1, xp, yp, zp, yRotp, xRotp); // 4J - changed "no data" value to be -1, we can have a valid entity id of 0
}
AddEntityPacket::AddEntityPacket(shared_ptr<Entity> e, int type, int data, int yRotp, int xRotp, int xp, int yp, int zp )
AddEntityPacket::AddEntityPacket(shared_ptr<Entity> e, int type, int data, int yRotp, int xRotp, int xp, int yp, int zp )
{
_init(e, type, data, xp, yp, zp, yRotp, xRotp);
}
@@ -55,7 +62,13 @@ AddEntityPacket::AddEntityPacket(shared_ptr<Entity> e, int type, int data, int y
void AddEntityPacket::read(DataInputStream *dis) // throws IOException TODO 4J JEV add throws statement
{
id = dis->readInt();
type = dis->readByte();
#ifdef _WIN32
type = dis->readByte();
#else
type = std::to_integer<int>(dis->readByte());
#endif
#ifdef _LARGE_WORLDS
x = dis->readInt();
y = dis->readInt();
@@ -79,7 +92,12 @@ void AddEntityPacket::read(DataInputStream *dis) // throws IOException TODO 4J
void AddEntityPacket::write(DataOutputStream *dos) // throws IOException TODO 4J JEV add throws statement
{
dos->writeInt(id);
dos->writeByte(type);
#ifdef _WIN32
dos->writeByte(type);
#else
dos->writeByte(static_cast<std::byte>(type));
#endif
#ifdef _LARGE_WORLDS
dos->writeInt(x);
dos->writeInt(y);
@@ -100,12 +118,12 @@ void AddEntityPacket::write(DataOutputStream *dos) // throws IOException TODO 4J
}
}
void AddEntityPacket::handle(PacketListener *listener)
void AddEntityPacket::handle(PacketListener *listener)
{
listener->handleAddEntity(shared_from_this());
}
int AddEntityPacket::getEstimatedSize()
int AddEntityPacket::getEstimatedSize()
{
#ifdef _LARGE_WORLDS
int posSize = 4 + 4 + 4;