aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/RotateHeadPacket.cpp
blob: a0cd02d7d565456531fbf69e129c9e8d6cb0e7ec (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
42
43
44
45
46
47
48
49
50
51
#include "stdafx.h"

#include "RotateHeadPacket.h"

RotateHeadPacket::RotateHeadPacket()
{
}

RotateHeadPacket::RotateHeadPacket(int id, char yHeadRot)
{
	this->id = id;
	this->yHeadRot = yHeadRot;
}

void RotateHeadPacket::read(DataInputStream *dis)
{
	id = dis->readInt();
	yHeadRot = dis->readByte();
}

void RotateHeadPacket::write(DataOutputStream *dos)
{
	dos->writeInt(id);
	dos->writeByte(yHeadRot);
}

void RotateHeadPacket::handle(PacketListener *listener)
{
	listener->handleRotateMob(shared_from_this());
}

int RotateHeadPacket::getEstimatedSize()
{
	return 5;
}

bool RotateHeadPacket::canBeInvalidated()
{
	return true;
}

bool RotateHeadPacket::isInvalidatedBy(shared_ptr<Packet> packet)
{
	shared_ptr<RotateHeadPacket> target = dynamic_pointer_cast<RotateHeadPacket>(packet);
	return target->id == id;
}

bool RotateHeadPacket::isAync()
{
	return true;
}