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 "TileEventPacket.h"
6#include "net.minecraft.world.level.tile.h"
7
8TileEventPacket::TileEventPacket()
9{
10 x = 0;
11 y = 0;
12 z = 0;
13 b0 = 0;
14 b1 = 0;
15 tile = 0;
16}
17
18TileEventPacket::TileEventPacket(int x, int y, int z, int tile, int b0, int b1)
19{
20 this->x = x;
21 this->y = y;
22 this->z = z;
23 this->b0 = b0;
24 this->b1 = b1;
25 this->tile = tile;
26}
27
28void TileEventPacket::read(DataInputStream *dis) //throws IOException
29{
30 x = dis->readInt();
31 y = dis->readShort();
32 z = dis->readInt();
33 b0 = dis->readUnsignedByte();
34 b1 = dis->readUnsignedByte();
35 tile = dis->readShort() & Tile::TILE_NUM_MASK;
36}
37
38void TileEventPacket::write(DataOutputStream *dos) //throws IOException
39{
40 dos->writeInt(x);
41 dos->writeShort(y);
42 dos->writeInt(z);
43 dos->write(b0);
44 dos->write(b1);
45 dos->writeShort(tile & Tile::TILE_NUM_MASK);
46}
47
48void TileEventPacket::handle(PacketListener *listener)
49{
50 listener->handleTileEvent(shared_from_this());
51}
52
53int TileEventPacket::getEstimatedSize()
54{
55 return 2 * 4 + 2 + 2 + 2;
56}