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 "InteractPacket.h"
6
7
8
9const int InteractPacket::INTERACT = 0;
10const int InteractPacket::ATTACK = 1;
11
12InteractPacket::InteractPacket()
13{
14 source = 0;
15 target = 0;
16 action = 0;
17}
18
19InteractPacket::InteractPacket(int source, int target, int action)
20{
21 this->source = source;
22 this->target = target;
23 this->action = action;
24}
25
26void InteractPacket::read(DataInputStream *dis) //throws IOException
27{
28 source = dis->readInt();
29 target = dis->readInt();
30 action = dis->readByte();
31}
32
33void InteractPacket::write(DataOutputStream *dos) // throws IOException
34{
35 dos->writeInt(source);
36 dos->writeInt(target);
37 dos->writeByte(action);
38}
39
40void InteractPacket::handle(PacketListener *listener)
41{
42 listener->handleInteract(shared_from_this());
43}
44
45int InteractPacket::getEstimatedSize()
46{
47 return 9;
48}