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 "GameEventPacket.h"
6
7
8
9const int GameEventPacket::NO_RESPAWN_BED_AVAILABLE = 0;
10const int GameEventPacket::START_RAINING = 1;
11const int GameEventPacket::STOP_RAINING = 2;
12const int GameEventPacket::CHANGE_GAME_MODE = 3; // 1.8.2
13const int GameEventPacket::WIN_GAME = 4; // 1.0.1
14const int GameEventPacket::DEMO_EVENT = 5;
15
16const int GameEventPacket::DEMO_PARAM_INTRO = 0;
17const int GameEventPacket::DEMO_PARAM_HINT_1 = 101;
18const int GameEventPacket::DEMO_PARAM_HINT_2 = 102;
19const int GameEventPacket::DEMO_PARAM_HINT_3 = 103;
20
21// 4J Added
22const int GameEventPacket::START_SAVING = 10;
23const int GameEventPacket::STOP_SAVING = 11;
24
25const int GameEventPacket::EVENT_LANGUAGE_ID[EVENT_LANGUAGE_ID_LENGTH] = { IDS_TILE_BED_NOT_VALID, -1, -1, IDS_GAME_MODE_CHANGED, -1, -1 };
26
27GameEventPacket::GameEventPacket()
28{
29 this->_event = 0;
30 this->param = 0;
31}
32
33GameEventPacket::GameEventPacket(int _event, int param)
34{
35 this->_event = _event;
36 this->param = param;
37}
38
39void GameEventPacket::read(DataInputStream *dis) //throws IOException
40{
41 _event = dis->readByte();
42 param = dis->readByte();
43}
44
45void GameEventPacket::write(DataOutputStream *dos) //throws IOException
46{
47 dos->writeByte(_event);
48 dos->writeByte(param);
49}
50
51void GameEventPacket::handle(PacketListener *listener)
52{
53 listener->handleGameEvent(shared_from_this());
54}
55
56int GameEventPacket::getEstimatedSize()
57{
58 return 2;
59}