the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#include "stdafx.h"
2#include <iostream>
3#include "InputOutputStream.h"
4#include "PacketListener.h"
5#include "PlayerActionPacket.h"
6
7const int PlayerActionPacket::START_DESTROY_BLOCK = 0;
8const int PlayerActionPacket::ABORT_DESTROY_BLOCK = 1;
9const int PlayerActionPacket::STOP_DESTROY_BLOCK = 2;
10const int PlayerActionPacket::DROP_ALL_ITEMS = 3;
11const int PlayerActionPacket::DROP_ITEM = 4;
12const int PlayerActionPacket::RELEASE_USE_ITEM = 5;
13
14PlayerActionPacket::PlayerActionPacket()
15{
16 x = 0;
17 y = 0;
18 z = 0;
19 face = 0;
20 action = 0;
21}
22
23PlayerActionPacket::PlayerActionPacket(int action, int x, int y, int z, int face)
24{
25 this->action = action;
26 this->x = x;
27 this->y = y;
28 this->z = z;
29 this->face = face;
30}
31
32void PlayerActionPacket::read(DataInputStream *dis) //throws IOException
33{
34 action = dis->readUnsignedByte();
35 x = dis->readInt();
36 y = dis->readUnsignedByte();
37 z = dis->readInt();
38 face = dis->readUnsignedByte();
39}
40
41void PlayerActionPacket::write(DataOutputStream *dos) //throws IOException
42{
43 dos->write(action);
44 dos->writeInt(x);
45 dos->write(y);
46 dos->writeInt(z);
47 dos->write(face);
48}
49
50void PlayerActionPacket::handle(PacketListener *listener)
51{
52 listener->handlePlayerAction(shared_from_this());
53}
54
55int PlayerActionPacket::getEstimatedSize()
56{
57 return 11;
58}