mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-08-20 09:57:10 +00:00
Remove DWORD skin IDs from texture geometry packets
This commit is contained in:
parent
85ddd0cca0
commit
bd2c3fca18
|
|
@ -1,4 +1,5 @@
|
||||||
#include "../../Platform/stdafx.h"
|
#include "../../Platform/stdafx.h"
|
||||||
|
#include <cstring>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "../../IO/Streams/InputOutputStream.h"
|
#include "../../IO/Streams/InputOutputStream.h"
|
||||||
#include "../../Headers/net.minecraft.world.entity.h"
|
#include "../../Headers/net.minecraft.world.entity.h"
|
||||||
|
|
@ -31,14 +32,17 @@ TextureAndGeometryChangePacket::TextureAndGeometryChangePacket(std::shared_ptr<E
|
||||||
void TextureAndGeometryChangePacket::read(DataInputStream *dis) //throws IOException
|
void TextureAndGeometryChangePacket::read(DataInputStream *dis) //throws IOException
|
||||||
{
|
{
|
||||||
id = dis->readInt();
|
id = dis->readInt();
|
||||||
dwSkinID = dis->readInt();
|
int skinId = dis->readInt();
|
||||||
|
std::memcpy(&dwSkinID, &skinId, sizeof(dwSkinID));
|
||||||
path = dis->readUTF();
|
path = dis->readUTF();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextureAndGeometryChangePacket::write(DataOutputStream *dos) //throws IOException
|
void TextureAndGeometryChangePacket::write(DataOutputStream *dos) //throws IOException
|
||||||
{
|
{
|
||||||
dos->writeInt(id);
|
dos->writeInt(id);
|
||||||
dos->writeInt(dwSkinID);
|
int skinId = 0;
|
||||||
|
std::memcpy(&skinId, &dwSkinID, sizeof(dwSkinID));
|
||||||
|
dos->writeInt(skinId);
|
||||||
dos->writeUTF(path);
|
dos->writeUTF(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
#include "Packet.h"
|
#include "Packet.h"
|
||||||
|
|
||||||
|
|
@ -9,7 +9,7 @@ public:
|
||||||
|
|
||||||
int id;
|
int id;
|
||||||
std::wstring path;
|
std::wstring path;
|
||||||
DWORD dwSkinID;
|
std::uint32_t dwSkinID;
|
||||||
|
|
||||||
TextureAndGeometryChangePacket();
|
TextureAndGeometryChangePacket();
|
||||||
TextureAndGeometryChangePacket(std::shared_ptr<Entity> e, const std::wstring &path);
|
TextureAndGeometryChangePacket(std::shared_ptr<Entity> e, const std::wstring &path);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#include "../../Platform/stdafx.h"
|
#include "../../Platform/stdafx.h"
|
||||||
|
#include <cstring>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "../../IO/Streams/InputOutputStream.h"
|
#include "../../IO/Streams/InputOutputStream.h"
|
||||||
#include "PacketListener.h"
|
#include "PacketListener.h"
|
||||||
|
|
@ -122,7 +123,8 @@ void TextureAndGeometryPacket::handle(PacketListener *listener)
|
||||||
void TextureAndGeometryPacket::read(DataInputStream *dis) //throws IOException
|
void TextureAndGeometryPacket::read(DataInputStream *dis) //throws IOException
|
||||||
{
|
{
|
||||||
textureName = dis->readUTF();
|
textureName = dis->readUTF();
|
||||||
dwSkinID = (DWORD)dis->readInt();
|
int skinId = dis->readInt();
|
||||||
|
std::memcpy(&dwSkinID, &skinId, sizeof(dwSkinID));
|
||||||
dwTextureBytes = (std::uint32_t)dis->readShort();
|
dwTextureBytes = (std::uint32_t)dis->readShort();
|
||||||
|
|
||||||
if(dwTextureBytes>0)
|
if(dwTextureBytes>0)
|
||||||
|
|
@ -160,7 +162,9 @@ void TextureAndGeometryPacket::read(DataInputStream *dis) //throws IOException
|
||||||
void TextureAndGeometryPacket::write(DataOutputStream *dos) //throws IOException
|
void TextureAndGeometryPacket::write(DataOutputStream *dos) //throws IOException
|
||||||
{
|
{
|
||||||
dos->writeUTF(textureName);
|
dos->writeUTF(textureName);
|
||||||
dos->writeInt(dwSkinID);
|
int skinId = 0;
|
||||||
|
std::memcpy(&skinId, &dwSkinID, sizeof(dwSkinID));
|
||||||
|
dos->writeInt(skinId);
|
||||||
dos->writeShort((short)dwTextureBytes);
|
dos->writeShort((short)dwTextureBytes);
|
||||||
for(std::uint32_t i=0;i<dwTextureBytes;i++)
|
for(std::uint32_t i=0;i<dwTextureBytes;i++)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ class TextureAndGeometryPacket : public Packet, public std::enable_shared_from_t
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::wstring textureName;
|
std::wstring textureName;
|
||||||
DWORD dwSkinID;
|
std::uint32_t dwSkinID;
|
||||||
std::uint8_t *pbData;
|
std::uint8_t *pbData;
|
||||||
std::uint32_t dwTextureBytes;
|
std::uint32_t dwTextureBytes;
|
||||||
SKIN_BOX *BoxDataA;
|
SKIN_BOX *BoxDataA;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue