1#if PROTOCOL_VERSION > 344
19#if PROTOCOL_VERSION < 759
38 SetFlags(ReadData<char>(iter, length));
39 SetChildren(
ReadData<std::vector<VarInt>>(iter, length));
40 if (GetFlags() & 0x08)
42 SetRedirectNode(ReadData<VarInt>(iter, length));
44 const char node_type = GetFlags() & 0x03;
45 if (node_type == 1 || node_type == 2)
47 SetName(ReadData<std::string>(iter, length));
51#if PROTOCOL_VERSION < 759
52 SetParser(ReadData<Identifier>(iter, length));
55 SetParserId(ReadData<BrigadierPropertyType, VarInt>(iter, length));
58 GetProperties()->Read(iter, length);
59 if (GetFlags() & 0x10)
61 SetSuggestionType(ReadData<Identifier>(iter, length));
68 WriteData<char>(GetFlags(), container);
69 WriteData<std::vector<VarInt>>(GetChildren(), container);
70 if (GetFlags() & 0x08)
72 WriteData<VarInt>(GetRedirectNode(), container);
74 const char node_type = GetFlags() & 0x03;
75 if (node_type == 1 || node_type == 2)
77 WriteData<std::string>(GetName(), container);
81#if PROTOCOL_VERSION < 759
82 WriteData<Identifier>(GetParser(), container);
84 WriteData<BrigadierPropertyType, VarInt>(GetParserId(), container);
86 GetProperties()->Write(container);
87 if (GetFlags() & 0x10)
89 WriteData<Identifier>(GetSuggestionType(), container);
98 output[std::string(field_name<Flags_index>)] = GetFlags();
99 output[std::string(field_name<Children_index>)] = GetChildren();
101 if (GetFlags() & 0x08)
103 output[std::string(field_name<RedirectNode_index>)] = GetRedirectNode();
106 const char node_type = GetFlags() & 0x03;
107 if (node_type == 1 || node_type == 2)
109 output[std::string(field_name<Name_index>)] = GetName();
113#if PROTOCOL_VERSION < 759
114 output[std::string(field_name<Parser_index>)] = GetParser();
116 output[std::string(field_name<ParserId_index>)] = GetParserId();
118 output[std::string(field_name<Properties_index>)] = GetProperties()->Serialize();
119 if (GetFlags() & 0x10)
121 output[std::string(field_name<SuggestionType_index>)] = GetSuggestionType();
#define SERIALIZED_FIELD(Name,...)
static std::shared_ptr< BrigadierProperty > CreateProperties(const BrigadierPropertyType parser_id)
SERIALIZED_FIELD(Name, std::string)
SERIALIZED_FIELD(RedirectNode, VarInt)
SERIALIZED_FIELD(Flags, char)
virtual void ReadImpl(ReadIterator &iter, size_t &length) override
SERIALIZED_FIELD(ParserId, Internal::DiffType< BrigadierPropertyType, VarInt >)
SERIALIZED_FIELD(SuggestionType, Identifier)
virtual Json::Value SerializeImpl() const override
SERIALIZED_FIELD(Properties, std::shared_ptr< BrigadierProperty >)
SERIALIZED_FIELD(Children, std::vector< VarInt >)
virtual void WriteImpl(WriteContainer &container) const override
Main class, basically a JsonVariant with extra utility functions it doesn't inherit JsonVariant direc...
StorageType ReadData(ReadIterator &iter, size_t &length)
std::vector< unsigned char > WriteContainer
std::vector< unsigned char >::const_iterator ReadIterator
Just a simple type wrapper that will store with T1 and serialize as T2 (can be used for Enum/VarInt f...