forked from mmbednarek/minecpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommon.schema.cpp
More file actions
35 lines (29 loc) · 915 Bytes
/
Common.schema.cpp
File metadata and controls
35 lines (29 loc) · 915 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <minecpp/net/play/Common.schema.h>
#include "minecpp/network/NetworkUtil.h"
#include <algorithm>
namespace minecpp::net::play {
void Chat::serialize(::minecpp::network::message::Writer &writer) const
{
writer.write_string(this->format);
}
Chat Chat::deserialize(::minecpp::network::message::Reader &reader)
{
Chat result;
result.format = reader.read_string();
return result;
}
void Slot::serialize(::minecpp::network::message::Writer &writer) const
{
writer.write_varint(this->item_id);
writer.write_sbyte(this->item_count);
this->data.serialize(writer.raw_stream(), "");
}
Slot Slot::deserialize(::minecpp::network::message::Reader &reader)
{
Slot result;
result.item_id = reader.read_varint();
result.item_count = reader.read_sbyte();
result.data = nbt::item::SlotData::deserialize(reader.raw_stream());
return result;
}
}// namespace minecpp::net::play