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 "net.minecraft.world.level.tile.entity.h"
6#include "SignUpdatePacket.h"
7
8
9
10SignUpdatePacket::SignUpdatePacket()
11{
12 shouldDelay = true;
13 m_bVerified=false;
14 m_bCensored=false;
15 x = 0;
16 y = 0;
17 z = 0;
18
19}
20
21SignUpdatePacket::SignUpdatePacket(int x, int y, int z, bool bVerified, bool bCensored, wstring lines[])
22{
23 shouldDelay = true;
24 this->m_bVerified=bVerified;
25 this->m_bCensored=bCensored;
26 this->x = x;
27 this->y = y;
28 this->z = z;
29 for( int i = 0; i < MAX_SIGN_LINES; i++ ) this->lines[i] = lines[i];
30}
31
32void SignUpdatePacket::read(DataInputStream *dis) //throws IOException
33{
34 x = dis->readInt();
35 y = dis->readShort();
36 z = dis->readInt();
37 this->m_bVerified=dis->readBoolean();
38 this->m_bCensored=dis->readBoolean();;
39 for (int i = 0; i < MAX_SIGN_LINES; i++)
40 lines[i] = readUtf(dis, SignTileEntity::MAX_LINE_LENGTH);
41}
42
43void SignUpdatePacket::write(DataOutputStream *dos) //throws IOException
44{
45 dos->writeInt(x);
46 dos->writeShort(y);
47 dos->writeInt(z);
48 dos->writeBoolean(m_bVerified);
49 dos->writeBoolean(m_bCensored);
50 for (int i = 0; i < MAX_SIGN_LINES; i++)
51 writeUtf(lines[i], dos);
52}
53
54void SignUpdatePacket::handle(PacketListener *listener)
55{
56 listener->handleSignUpdate(shared_from_this());
57}
58
59int SignUpdatePacket::getEstimatedSize()
60{
61 int l = 0;
62 l+=sizeof(int);
63 l+=sizeof(short);
64 l+=sizeof(int);
65 l+=sizeof(byte);
66 l+=sizeof(byte);
67
68 for (int i = 0; i < MAX_SIGN_LINES; i++)
69 l += (int)lines[i].length();
70 return l;
71}