mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-05-25 08:05:28 +00:00
TU19: fix build fallout across Client, World, NBT and Network
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
#include "../../Platform/stdafx.h"
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include "../../IO/Streams/InputOutputStream.h"
|
||||
#include "../../Headers/net.minecraft.world.entity.player.h"
|
||||
@@ -44,9 +43,9 @@ AddPlayerPacket::AddPlayerPacket(std::shared_ptr<Player> player, PlayerUID xuid,
|
||||
// this in sync with other clients
|
||||
yRot = yRotp;
|
||||
xRot = xRotp;
|
||||
yHeadRot = static_cast<std::uint8_t>(yHeadRotp); // 4J Added
|
||||
// yRot = (std::uint8_t) (player->yRot * 256 / 360);
|
||||
// xRot = (std::uint8_t) (player->xRot * 256 / 360);
|
||||
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);
|
||||
@@ -57,7 +56,7 @@ AddPlayerPacket::AddPlayerPacket(std::shared_ptr<Player> player, PlayerUID xuid,
|
||||
|
||||
this->xuid = xuid;
|
||||
this->OnlineXuid = OnlineXuid;
|
||||
m_playerIndex = static_cast<std::uint8_t>(player->getPlayerIndex());
|
||||
m_playerIndex = (BYTE)player->getPlayerIndex();
|
||||
m_skinId = player->getCustomSkin();
|
||||
m_capeId = player->getCustomCape();
|
||||
m_uiGamePrivileges = player->getAllPlayerGamePrivileges();
|
||||
@@ -73,17 +72,19 @@ void AddPlayerPacket::read(DataInputStream* dis) // throws IOException
|
||||
x = dis->readInt();
|
||||
y = dis->readInt();
|
||||
z = dis->readInt();
|
||||
yRot = static_cast<char>(dis->readByte());
|
||||
xRot = static_cast<char>(dis->readByte());
|
||||
yRot = dis->readByte();
|
||||
xRot = dis->readByte();
|
||||
yHeadRot = dis->readByte(); // 4J Added
|
||||
carriedItem = dis->readShort();
|
||||
xuid = dis->readPlayerUID();
|
||||
OnlineXuid = dis->readPlayerUID();
|
||||
m_playerIndex = dis->readByte();
|
||||
m_skinId = static_cast<std::uint32_t>(dis->readInt());
|
||||
m_capeId = static_cast<std::uint32_t>(dis->readInt());
|
||||
int privileges = dis->readInt();
|
||||
m_uiGamePrivileges = static_cast<unsigned int>(privileges);
|
||||
INT skinId = dis->readInt();
|
||||
m_skinId = *(DWORD*)&skinId;
|
||||
INT capeId = dis->readInt();
|
||||
m_capeId = *(DWORD*)&capeId;
|
||||
INT privileges = dis->readInt();
|
||||
m_uiGamePrivileges = *(unsigned int*)&privileges;
|
||||
MemSect(1);
|
||||
unpack = SynchedEntityData::unpack(dis);
|
||||
MemSect(0);
|
||||
@@ -98,13 +99,13 @@ void AddPlayerPacket::write(DataOutputStream* dos) // throws IOException
|
||||
dos->writeInt(z);
|
||||
dos->writeByte(static_cast<std::uint8_t>(yRot));
|
||||
dos->writeByte(static_cast<std::uint8_t>(xRot));
|
||||
dos->writeByte(static_cast<std::uint8_t>(m_playerIndex)); // 4J Added
|
||||
dos->writeByte(static_cast<std::uint8_t>(yHeadRot)); // 4J Added
|
||||
dos->writeShort(carriedItem);
|
||||
dos->writePlayerUID(xuid);
|
||||
dos->writePlayerUID(OnlineXuid);
|
||||
dos->writeByte(static_cast<std::uint8_t>(m_playerIndex)); // 4J Added
|
||||
dos->writeInt(static_cast<int>(m_skinId));
|
||||
dos->writeInt(static_cast<int>(m_capeId));
|
||||
dos->writeByte(static_cast<std::uint8_t>(m_playerIndex));
|
||||
dos->writeInt(m_skinId);
|
||||
dos->writeInt(m_capeId);
|
||||
dos->writeInt(m_uiGamePrivileges);
|
||||
entityData->packAll(dos);
|
||||
}
|
||||
@@ -115,10 +116,10 @@ void AddPlayerPacket::handle(PacketListener* listener) {
|
||||
|
||||
int AddPlayerPacket::getEstimatedSize() {
|
||||
int iSize = sizeof(int) + Player::MAX_NAME_LENGTH + sizeof(int) +
|
||||
sizeof(int) + sizeof(int) + sizeof(std::uint8_t) +
|
||||
sizeof(std::uint8_t) + sizeof(short) + sizeof(PlayerUID) +
|
||||
sizeof(PlayerUID) + sizeof(int) + sizeof(std::uint8_t) +
|
||||
sizeof(unsigned int) + sizeof(std::uint8_t);
|
||||
sizeof(int) + sizeof(int) + sizeof(BYTE) + sizeof(BYTE) +
|
||||
sizeof(short) + sizeof(PlayerUID) + sizeof(PlayerUID) +
|
||||
sizeof(int) + sizeof(BYTE) + sizeof(unsigned int) +
|
||||
sizeof(uint8_t);
|
||||
|
||||
if (entityData != NULL) {
|
||||
iSize += entityData->getSizeInBytes();
|
||||
|
||||
Reference in New Issue
Block a user