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 "LevelEventPacket.h"
6
7
8
9LevelEventPacket::LevelEventPacket()
10{
11 type = 0;
12 data = 0;
13 x = 0;
14 y = 0;
15 z = 0;
16}
17
18LevelEventPacket::LevelEventPacket(int type, int x, int y, int z, int data, bool globalEvent)
19{
20 this->type = type;
21 this->x = x;
22 this->y = y;
23 this->z = z;
24 this->data = data;
25 this->globalEvent = globalEvent;
26}
27
28void LevelEventPacket::read(DataInputStream *dis) //throws IOException
29{
30 type = dis->readInt();
31 x = dis->readInt();
32 y = dis->readByte() & 0xff;
33 z = dis->readInt();
34 data = dis->readInt();
35 globalEvent = dis->readBoolean();
36}
37
38void LevelEventPacket::write(DataOutputStream *dos) //throws IOException
39{
40 dos->writeInt(type);
41 dos->writeInt(x);
42 dos->writeByte(y & 0xff);
43 dos->writeInt(z);
44 dos->writeInt(data);
45 dos->writeBoolean(globalEvent);
46}
47
48void LevelEventPacket::handle(PacketListener *listener)
49{
50 listener->handleLevelEvent(shared_from_this());
51}
52
53int LevelEventPacket::getEstimatedSize()
54{
55 return 4 * 5 + 1;
56}
57
58bool LevelEventPacket::isGlobalEvent()
59{
60 return globalEvent;
61}