From b691c43c44ff180d10e7d4a9afc83b98551ff586 Mon Sep 17 00:00:00 2001 From: daoge_cmd <3523206925@qq.com> Date: Sun, 1 Mar 2026 12:16:08 +0800 Subject: Initial commit --- Minecraft.World/TextureAndGeometryChangePacket.cpp | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Minecraft.World/TextureAndGeometryChangePacket.cpp (limited to 'Minecraft.World/TextureAndGeometryChangePacket.cpp') diff --git a/Minecraft.World/TextureAndGeometryChangePacket.cpp b/Minecraft.World/TextureAndGeometryChangePacket.cpp new file mode 100644 index 00000000..04c88bed --- /dev/null +++ b/Minecraft.World/TextureAndGeometryChangePacket.cpp @@ -0,0 +1,53 @@ +#include "stdafx.h" +#include +#include "InputOutputStream.h" +#include "net.minecraft.world.entity.h" +#include "PacketListener.h" +#include "TextureAndGeometryChangePacket.h" + + + + +TextureAndGeometryChangePacket::TextureAndGeometryChangePacket() +{ + id = -1; + path = L""; + dwSkinID = 0; +} + +TextureAndGeometryChangePacket::TextureAndGeometryChangePacket(shared_ptr e, const wstring &path) +{ + id = e->entityId; + this->path = path; + wstring skinValue = path.substr(7,path.size()); + skinValue = skinValue.substr(0,skinValue.find_first_of(L'.')); + std::wstringstream ss; + ss << std::dec << skinValue.c_str(); + ss >> dwSkinID; + dwSkinID = MAKE_SKIN_BITMASK(true, dwSkinID); + +} + +void TextureAndGeometryChangePacket::read(DataInputStream *dis) //throws IOException +{ + id = dis->readInt(); + dwSkinID = dis->readInt(); + path = dis->readUTF(); +} + +void TextureAndGeometryChangePacket::write(DataOutputStream *dos) //throws IOException +{ + dos->writeInt(id); + dos->writeInt(dwSkinID); + dos->writeUTF(path); +} + +void TextureAndGeometryChangePacket::handle(PacketListener *listener) +{ + listener->handleTextureAndGeometryChange(shared_from_this()); +} + +int TextureAndGeometryChangePacket::getEstimatedSize() +{ + return 8 + (int)path.size(); +} -- cgit v1.2.3