1#if PROTOCOL_VERSION > 772
51 std::shared_ptr<DebugSubscriptionData> DebugSubscriptionDataFactory(
const DebugSubscriptionDataType debug_subscription_data_type_)
55 throw std::runtime_error(
"Unable to create debug subscription data with id: " + std::to_string(
static_cast<int>(debug_subscription_data_type_)) +
".");
58 switch (debug_subscription_data_type_)
61 return std::make_shared<DebugSubscriptionDataEmpty>();
63 return std::make_shared<DebugSubscriptionDataBeeInfo>();
65 return std::make_shared<DebugSubscriptionDataBrainDump>();
67 return std::make_shared<DebugSubscriptionDataBreezeInfo>();
69 return std::make_shared<DebugSubscriptionDataGoalInfo>();
71 return std::make_shared<DebugSubscriptionDataPathInfo>();
73 return std::make_shared<DebugSubscriptionDataEntityBlockIntersection>();
75 return std::make_shared<DebugSubscriptionDataHiveInfo>();
77 return std::make_shared<DebugSubscriptionDataPoiInfo>();
79 return std::make_shared<DebugSubscriptionDataOrientation>();
81 return std::make_shared<DebugSubscriptionDataEmpty>();
83 return std::make_shared<DebugSubscriptionDataRaids>();
85 return std::make_shared<DebugSubscriptionDataStructures>();
87 return std::make_shared<DebugSubscriptionDataGameEventListenerInfo>();
89 return std::make_shared<DebugSubscriptionDataNeighbor>();
91 return std::make_shared<DebugSubscriptionDataGameEventInfo>();
94 throw std::runtime_error(
"Unable to create debug subscription data with id: " + std::to_string(
static_cast<int>(debug_subscription_data_type_)) +
".");
99 throw std::runtime_error(
"Unable to create debug subscription data with id: " + std::to_string(
static_cast<int>(debug_subscription_data_type_)) +
".");
106 DataType = data_type_;
107 Data = DebugSubscriptionDataFactory(DataType);
114 DataType = data_type_;
122 DataType = ReadData<DebugSubscriptionDataType, VarInt>(iter, length);
123 const bool has_data = ReadData<bool>(iter, length);
126 Data = DebugSubscriptionDataFactory(DataType);
127 Data.value()->Read(iter, length);
133 WriteData<DebugSubscriptionDataType, VarInt>(DataType, container);
134 WriteData<bool>(Data.has_value(), container);
135 if (Data.has_value() && Data.value() !=
nullptr)
137 Data.value()->Write(container);
145 output[std::string(field_name<DataType_index>)] =
static_cast<int>(DataType);
146 if (Data.has_value())
148 output[std::string(field_name<Data_index>)] = Data ==
nullptr ? Json::Object() : Data.value()->
Serialize();
157 DataType = data_type_;
158 Data = DebugSubscriptionDataFactory(DataType);
165 DataType = ReadData<DebugSubscriptionDataType, VarInt>(iter, length);
166 Data = DebugSubscriptionDataFactory(DataType);
169 Data->Read(iter, length);
175 WriteData<DebugSubscriptionDataType, VarInt>(DataType, container);
178 Data->Write(container);
186 output[std::string(field_name<DataType_index>)] =
static_cast<int>(DataType);
187 output[std::string(field_name<Data_index>)] = Data ==
nullptr ? Json::Object() : Data->
Serialize();
#define DEFINE_NETWORK_TYPE(ClassName)
DebugSubscriptionEvent & SetDataType(const DebugSubscriptionDataType data_type_)
DebugSubscriptionUpdate & SetDataType(const DebugSubscriptionDataType data_type_)
DebugSubscriptionUpdate & SetDataTypeNoData(const DebugSubscriptionDataType data_type_)
virtual Json::Value SerializeImpl() const =0
virtual void WriteImpl(WriteContainer &container) const =0
virtual Json::Value Serialize() const
virtual void ReadImpl(ReadIterator &iter, size_t &length)=0
DebugSubscriptionDataType
@ DedicatedServerTickTime
@ NUM_DEBUG_SUBSCRIPTION_DATA_TYPES
@ EntityBlockIntersections
@ RedstoneWireOrientations
std::vector< unsigned char > WriteContainer
std::vector< unsigned char >::const_iterator ReadIterator