mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-05-16 16:13:51 +00:00
Initial commit
This commit is contained in:
parent
def8cb4153
commit
b691c43c44
19437 changed files with 4363922 additions and 0 deletions
53
Minecraft.World/TextureAndGeometryChangePacket.cpp
Normal file
53
Minecraft.World/TextureAndGeometryChangePacket.cpp
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
#include "stdafx.h"
|
||||
#include <iostream>
|
||||
#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<Entity> 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();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue