diff --git a/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.cpp b/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.cpp index 0115c2bd4..9efedd881 100644 --- a/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.cpp +++ b/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.cpp @@ -1,4 +1,5 @@ #include "../../Platform/stdafx.h" +#include #include #include "../../IO/Streams/InputOutputStream.h" #include "../../Headers/net.minecraft.world.entity.h" @@ -31,14 +32,17 @@ TextureAndGeometryChangePacket::TextureAndGeometryChangePacket(std::shared_ptrreadInt(); - dwSkinID = dis->readInt(); + int skinId = dis->readInt(); + std::memcpy(&dwSkinID, &skinId, sizeof(dwSkinID)); path = dis->readUTF(); } void TextureAndGeometryChangePacket::write(DataOutputStream *dos) //throws IOException { dos->writeInt(id); - dos->writeInt(dwSkinID); + int skinId = 0; + std::memcpy(&skinId, &dwSkinID, sizeof(dwSkinID)); + dos->writeInt(skinId); dos->writeUTF(path); } diff --git a/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.h b/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.h index 00001d8f3..7584b3c3e 100644 --- a/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.h +++ b/Minecraft.World/Network/Packets/TextureAndGeometryChangePacket.h @@ -1,5 +1,5 @@ #pragma once - +#include #include "Packet.h" @@ -9,7 +9,7 @@ public: int id; std::wstring path; - DWORD dwSkinID; + std::uint32_t dwSkinID; TextureAndGeometryChangePacket(); TextureAndGeometryChangePacket(std::shared_ptr e, const std::wstring &path); @@ -22,4 +22,4 @@ public: public: static std::shared_ptr create() { return std::shared_ptr(new TextureAndGeometryChangePacket()); } virtual int getId() { return 161; } -}; \ No newline at end of file +}; diff --git a/Minecraft.World/Network/Packets/TextureAndGeometryPacket.cpp b/Minecraft.World/Network/Packets/TextureAndGeometryPacket.cpp index 131d42775..941b468ff 100644 --- a/Minecraft.World/Network/Packets/TextureAndGeometryPacket.cpp +++ b/Minecraft.World/Network/Packets/TextureAndGeometryPacket.cpp @@ -1,4 +1,5 @@ #include "../../Platform/stdafx.h" +#include #include #include "../../IO/Streams/InputOutputStream.h" #include "PacketListener.h" @@ -122,7 +123,8 @@ void TextureAndGeometryPacket::handle(PacketListener *listener) void TextureAndGeometryPacket::read(DataInputStream *dis) //throws IOException { textureName = dis->readUTF(); - dwSkinID = (DWORD)dis->readInt(); + int skinId = dis->readInt(); + std::memcpy(&dwSkinID, &skinId, sizeof(dwSkinID)); dwTextureBytes = (std::uint32_t)dis->readShort(); if(dwTextureBytes>0) @@ -160,7 +162,9 @@ void TextureAndGeometryPacket::read(DataInputStream *dis) //throws IOException void TextureAndGeometryPacket::write(DataOutputStream *dos) //throws IOException { dos->writeUTF(textureName); - dos->writeInt(dwSkinID); + int skinId = 0; + std::memcpy(&skinId, &dwSkinID, sizeof(dwSkinID)); + dos->writeInt(skinId); dos->writeShort((short)dwTextureBytes); for(std::uint32_t i=0;i