* Fixed boats falling and a TP glitch #266 * Replaced every C-style cast with C++ ones * Replaced every C-style cast with C++ ones * Fixed boats falling and a TP glitch #266 * Updated NULL to nullptr and fixing some type issues * Modernized and fixed a few bugs - Replaced most instances of `NULL` with `nullptr`. - Replaced most `shared_ptr(new ...)` with `make_shared`. - Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances. * Fixing more conflicts * Replace int loops with size_t and start work on overrides
54 lines
1.2 KiB
C++
54 lines
1.2 KiB
C++
#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 + static_cast<int>(path.size());
|
|
}
|