aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/EntityEventPacket.cpp
blob: e92d76926032363dff71a591e9dcf86c841ed873 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "stdafx.h"
#include <iostream>
#include "InputOutputStream.h"
#include "PacketListener.h"
#include "EntityEventPacket.h"



EntityEventPacket::EntityEventPacket() 
{
	entityId = 0;
	eventId = 0;
}

EntityEventPacket::EntityEventPacket(int entityId, byte 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;
}