mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-04-24 12:23:36 +00:00
35 lines
857 B
C++
35 lines
857 B
C++
#include "../../Platform/stdafx.h"
|
|
#include <iostream>
|
|
#include "../../IO/Streams/InputOutputStream.h"
|
|
#include "../../Headers/net.minecraft.world.entity.h"
|
|
#include "PacketListener.h"
|
|
#include "AnimatePacket.h"
|
|
|
|
AnimatePacket::AnimatePacket() {
|
|
id = -1;
|
|
action = 0;
|
|
}
|
|
|
|
AnimatePacket::AnimatePacket(std::shared_ptr<Entity> e, int action) {
|
|
id = e->entityId;
|
|
this->action = action;
|
|
}
|
|
|
|
void AnimatePacket::read(DataInputStream* dis) // throws IOException
|
|
{
|
|
id = dis->readInt();
|
|
action = static_cast<int>(dis->readByte());
|
|
}
|
|
|
|
void AnimatePacket::write(DataOutputStream* dos) // throws IOException
|
|
{
|
|
dos->writeInt(id);
|
|
dos->writeByte(static_cast<uint8_t>(action));
|
|
}
|
|
|
|
void AnimatePacket::handle(PacketListener* listener) {
|
|
listener->handleAnimate(shared_from_this());
|
|
}
|
|
|
|
int AnimatePacket::getEstimatedSize() { return 5; }
|