mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-04-24 09:07:48 +00:00
34 lines
835 B
C++
34 lines
835 B
C++
#include "../../Platform/stdafx.h"
|
|
#include <iostream>
|
|
#include "../../IO/Streams/InputOutputStream.h"
|
|
#include "PacketListener.h"
|
|
#include "EntityEventPacket.h"
|
|
|
|
EntityEventPacket::EntityEventPacket() {
|
|
entityId = 0;
|
|
eventId = (uint8_t)0;
|
|
}
|
|
|
|
EntityEventPacket::EntityEventPacket(int entityId, uint8_t eventId) {
|
|
this->entityId = entityId;
|
|
this->eventId = eventId;
|
|
}
|
|
|
|
void EntityEventPacket::read(DataInputStream* dis) // throws IOException
|
|
{
|
|
entityId = dis->readInt();
|
|
eventId = dis->readByte();
|
|
}
|
|
|
|
void EntityEventPacket::write(DataOutputStream* dos) // throws IOException
|
|
{
|
|
dos->writeInt(entityId);
|
|
dos->writeByte(eventId);
|
|
}
|
|
|
|
void EntityEventPacket::handle(PacketListener* listener) {
|
|
listener->handleEntityEvent(shared_from_this());
|
|
}
|
|
|
|
int EntityEventPacket::getEstimatedSize() { return 5; }
|