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
@@ -32,7 +32,7 @@ AddPlayerPacket::~AddPlayerPacket()
|
||||
if(unpack != nullptr) delete unpack;
|
||||
}
|
||||
|
||||
AddPlayerPacket::AddPlayerPacket(shared_ptr<Player> player, PlayerUID xuid, PlayerUID OnlineXuid,int xp, int yp, int zp, int yRotp, int xRotp, int yHeadRotp)
|
||||
AddPlayerPacket::AddPlayerPacket(shared_ptr<Player> player, PlayerUID xuid, PlayerUID OnlineXuid,int xp, int yp, int zp, int yRotp, int xRotp, int yHeadRotp)
|
||||
{
|
||||
id = player->entityId;
|
||||
name = player->getName();
|
||||
@@ -44,11 +44,12 @@ AddPlayerPacket::AddPlayerPacket(shared_ptr<Player> player, PlayerUID xuid, Play
|
||||
// 4J - changed - send current "previously sent" value of rotations to put this in sync with other clients
|
||||
yRot = yRotp;
|
||||
xRot = xRotp;
|
||||
yHeadRot = yHeadRotp; // 4J Added
|
||||
// yRot = (byte) (player->yRot * 256 / 360);
|
||||
// xRot = (byte) (player->xRot * 256 / 360);
|
||||
|
||||
//printf("%d: New add player (%f,%f,%f) : (%d,%d,%d) : xRot %d, yRot %d\n",id,player->x,player->y,player->z,x,y,z,xRot,yRot);
|
||||
#ifdef _WIN32
|
||||
yHeadRot = yHeadRotp;
|
||||
#else
|
||||
yHeadRot = static_cast<std::byte>(yHeadRotp);
|
||||
#endif
|
||||
|
||||
shared_ptr<ItemInstance> itemInstance = player->inventory->getSelected();
|
||||
carriedItem = itemInstance == nullptr ? 0 : itemInstance->id;
|
||||
@@ -71,15 +72,25 @@ void AddPlayerPacket::read(DataInputStream *dis) //throws IOException
|
||||
x = dis->readInt();
|
||||
y = dis->readInt();
|
||||
z = dis->readInt();
|
||||
yRot = dis->readByte();
|
||||
xRot = dis->readByte();
|
||||
#ifdef _WIN32
|
||||
yRot = dis->readByte();
|
||||
xRot = dis->readByte();
|
||||
#else
|
||||
yRot = static_cast<char>(dis->readByte());
|
||||
xRot = static_cast<char>(dis->readByte());
|
||||
#endif
|
||||
|
||||
yHeadRot = dis->readByte(); // 4J Added
|
||||
carriedItem = dis->readShort();
|
||||
xuid = dis->readPlayerUID();
|
||||
OnlineXuid = dis->readPlayerUID();
|
||||
m_playerIndex = dis->readByte();
|
||||
#ifdef _WIN32
|
||||
m_playerIndex = dis->readByte();
|
||||
#else
|
||||
m_playerIndex = static_cast<BYTE>(dis->readByte());
|
||||
#endif
|
||||
INT skinId = dis->readInt();
|
||||
m_skinId = *(DWORD *)&skinId;
|
||||
m_skinId = *(DWORD *)&skinId;
|
||||
INT capeId = dis->readInt();
|
||||
m_capeId = *(DWORD *)&capeId;
|
||||
INT privileges = dis->readInt();
|
||||
@@ -96,13 +107,27 @@ void AddPlayerPacket::write(DataOutputStream *dos) //throws IOException
|
||||
dos->writeInt(x);
|
||||
dos->writeInt(y);
|
||||
dos->writeInt(z);
|
||||
dos->writeByte(yRot);
|
||||
|
||||
#ifdef _WIN32
|
||||
dos->writeByte(yRot);
|
||||
dos->writeByte(xRot);
|
||||
dos->writeByte(yHeadRot); // 4J Added
|
||||
dos->writeByte(yHeadRot);
|
||||
#else
|
||||
dos->writeByte(static_cast<std::byte>(yRot));
|
||||
dos->writeByte(static_cast<std::byte>(xRot));
|
||||
dos->writeByte(static_cast<std::byte>(m_playerIndex));
|
||||
#endif
|
||||
|
||||
|
||||
dos->writeShort(carriedItem);
|
||||
dos->writePlayerUID(xuid);
|
||||
dos->writePlayerUID(OnlineXuid);
|
||||
dos->writeByte(m_playerIndex);
|
||||
|
||||
#ifdef _WIN32
|
||||
dos->writeByte(m_playerIndex);
|
||||
#else
|
||||
dos->writeByte(static_cast<std::byte>(m_playerIndex));
|
||||
#endif
|
||||
dos->writeInt(m_skinId);
|
||||
dos->writeInt(m_capeId);
|
||||
dos->writeInt(m_uiGamePrivileges);
|
||||
@@ -132,7 +157,7 @@ int AddPlayerPacket::getEstimatedSize()
|
||||
return iSize;
|
||||
}
|
||||
|
||||
vector<shared_ptr<SynchedEntityData::DataItem> > *AddPlayerPacket::getUnpackedData()
|
||||
vector<shared_ptr<SynchedEntityData::DataItem> > *AddPlayerPacket::getUnpackedData()
|
||||
{
|
||||
if (unpack == nullptr)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user