* 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
47 lines
1001 B
C++
47 lines
1001 B
C++
#include "stdafx.h"
|
|
#include <iostream>
|
|
#include "InputOutputStream.h"
|
|
#include "net.minecraft.world.entity.h"
|
|
#include "PacketListener.h"
|
|
#include "TextureChangePacket.h"
|
|
|
|
|
|
|
|
TextureChangePacket::TextureChangePacket()
|
|
{
|
|
id = -1;
|
|
action = e_TextureChange_Skin;
|
|
path = L"";
|
|
}
|
|
|
|
TextureChangePacket::TextureChangePacket(shared_ptr<Entity> e, ETextureChangeType action, const wstring &path)
|
|
{
|
|
id = e->entityId;
|
|
this->action = action;
|
|
this->path = path;
|
|
}
|
|
|
|
void TextureChangePacket::read(DataInputStream *dis) //throws IOException
|
|
{
|
|
id = dis->readInt();
|
|
action = static_cast<ETextureChangeType>(dis->readByte());
|
|
path = dis->readUTF();
|
|
}
|
|
|
|
void TextureChangePacket::write(DataOutputStream *dos) //throws IOException
|
|
{
|
|
dos->writeInt(id);
|
|
dos->writeByte(action);
|
|
dos->writeUTF(path);
|
|
}
|
|
|
|
void TextureChangePacket::handle(PacketListener *listener)
|
|
{
|
|
listener->handleTextureChange(shared_from_this());
|
|
}
|
|
|
|
int TextureChangePacket::getEstimatedSize()
|
|
{
|
|
return 5 + static_cast<int>(path.size());
|
|
}
|