mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
update component parent environment to the pack environment
This commit is contained in:
parent
3fe66e134d
commit
0082a3444e
4 changed files with 27 additions and 32 deletions
|
|
@ -380,25 +380,6 @@ void ContentLoader::loadBlockMaterial(BlockMaterial& def, const fs::path& file)
|
|||
root->str("break-sound", def.breakSound);
|
||||
}
|
||||
|
||||
template<class T, void(ContentLoader::*loadfunc)(T&, const std::string&, const std::string&)>
|
||||
static void load_defs(ContentLoader* cl, dynamic::List* arr, const ContentPack* pack, ContentUnitBuilder<T>& builder, size_t& counter) {
|
||||
if (arr == nullptr) {
|
||||
return;
|
||||
}
|
||||
for (size_t i = 0; i < arr->size(); i++) {
|
||||
std::string name = arr->str(i);
|
||||
auto colon = name.find(':');
|
||||
std::string full = colon == std::string::npos ? pack->id + ":" + name : name;
|
||||
if (colon != std::string::npos) name[colon] = '/';
|
||||
auto& def = builder.create(full);
|
||||
if (colon != std::string::npos) {
|
||||
def.scriptName = name.substr(0, colon) + '/' + def.scriptName;
|
||||
}
|
||||
cl->*loadfunc(def, full, name);
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
|
||||
void ContentLoader::load() {
|
||||
logger.info() << "loading pack [" << pack->id << "]";
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue