Remove DWORD skin IDs from texture geometry packets

This commit is contained in:
notmatthewbeshay 2026-03-10 02:19:50 +11:00
parent 85ddd0cca0
commit bd2c3fca18
4 changed files with 16 additions and 8 deletions

View file

@ -1,4 +1,5 @@
#include "../../Platform/stdafx.h"
#include <cstring>
#include <iostream>
#include "../../IO/Streams/InputOutputStream.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
{
id = dis->readInt();
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);
}

View file

@ -1,5 +1,5 @@
#pragma once
#include <cstdint>
#include "Packet.h"
@ -9,7 +9,7 @@ public:
int id;
std::wstring path;
DWORD dwSkinID;
std::uint32_t dwSkinID;
TextureAndGeometryChangePacket();
TextureAndGeometryChangePacket(std::shared_ptr<Entity> e, const std::wstring &path);
@ -22,4 +22,4 @@ public:
public:
static std::shared_ptr<Packet> create() { return std::shared_ptr<Packet>(new TextureAndGeometryChangePacket()); }
virtual int getId() { return 161; }
};
};

View file

@ -1,4 +1,5 @@
#include "../../Platform/stdafx.h"
#include <cstring>
#include <iostream>
#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<dwTextureBytes;i++)
{

View file

@ -11,7 +11,7 @@ class TextureAndGeometryPacket : public Packet, public std::enable_shared_from_t
{
public:
std::wstring textureName;
DWORD dwSkinID;
std::uint32_t dwSkinID;
std::uint8_t *pbData;
std::uint32_t dwTextureBytes;
SKIN_BOX *BoxDataA;