add block/item tags

This commit is contained in:
MihailRis
2025-08-30 23:26:07 +03:00
parent d59a901ae0
commit 8bdf31d7bb
9 changed files with 53 additions and 1 deletions
+1
View File
@@ -89,6 +89,7 @@ template<> void ContentUnitLoader<Block>::loadUnit(
) {
auto root = io::read_json(file);
process_properties(def, name, root);
process_tags(def, root);
if (root.has("parent")) {
const auto& parentName = root["parent"].asString();
@@ -21,3 +21,17 @@ inline void process_properties(T& def, const std::string& name, const dv::value&
process_method(def.properties, suffix, field, value);
}
}
template <typename T>
inline void process_tags(T& def, const dv::value& root) {
if (!root.has("tags")) {
return;
}
const auto& tags = root["tags"];
for (const auto& tagValue : tags) {
if (!tagValue.isString()) {
continue;
}
def.tags.push_back(tagValue.asString());
}
}
+1
View File
@@ -19,6 +19,7 @@ template<> void ContentUnitLoader<ItemDef>::loadUnit(
) {
auto root = io::read_json(file);
process_properties(def, name, root);
process_tags(def, root);
if (root.has("parent")) {
const auto& parentName = root["parent"].asString();