mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 20:41:49 +00:00
add block/item tags
This commit is contained in:
parent
d59a901ae0
commit
8bdf31d7bb
9 changed files with 53 additions and 1 deletions
|
|
@ -62,6 +62,27 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
struct TagsIndices {
|
||||
int nextIndex = 1;
|
||||
std::unordered_map<std::string, int> map;
|
||||
|
||||
int add(const std::string& tag) {
|
||||
const auto& found = map.find(tag);
|
||||
if (found != map.end()) {
|
||||
return found->second;
|
||||
}
|
||||
return map[tag] = nextIndex++;
|
||||
}
|
||||
|
||||
int indexOf(const std::string& tag) {
|
||||
const auto& found = map.find(tag);
|
||||
if (found == map.end()) {
|
||||
return -1;
|
||||
}
|
||||
return found->second;
|
||||
}
|
||||
};
|
||||
|
||||
class ContentBuilder {
|
||||
UptrsMap<std::string, BlockMaterial> blockMaterials;
|
||||
UptrsMap<std::string, rigging::SkeletonConfig> skeletons;
|
||||
|
|
@ -74,6 +95,7 @@ public:
|
|||
ContentUnitBuilder<GeneratorDef> generators {allNames, ContentType::GENERATOR};
|
||||
ResourceIndicesSet resourceIndices {};
|
||||
dv::value defaults = nullptr;
|
||||
TagsIndices tags {};
|
||||
|
||||
~ContentBuilder();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue