contentpack remove feature WIP

This commit is contained in:
MihailRis
2024-02-29 23:47:07 +03:00
parent a1f313bedc
commit 3862dbda66
18 changed files with 541 additions and 433 deletions
+5
View File
@@ -294,6 +294,7 @@ void ContentLoader::load(ContentBuilder& builder) {
auto runtime = new ContentPackRuntime(*pack, scripting::create_pack_environment(*pack));
builder.add(runtime);
env = runtime->getEnvironment()->getId();
ContentPackStats& stats = runtime->getStatsWriteable();
fixPackIndices();
@@ -306,6 +307,7 @@ void ContentLoader::load(ContentBuilder& builder) {
if (!fs::is_regular_file(pack->getContentFile()))
return;
auto root = files::read_json(pack->getContentFile());
auto blocksarr = root->list("blocks");
if (blocksarr) {
@@ -314,6 +316,7 @@ void ContentLoader::load(ContentBuilder& builder) {
std::string full = pack->id+":"+name;
auto& def = builder.createBlock(full);
loadBlock(def, full, name);
stats.totalBlocks++;
if (!def.hidden) {
auto& item = builder.createItem(full+BLOCK_ITEM_SUFFIX);
item.generated = true;
@@ -324,6 +327,7 @@ void ContentLoader::load(ContentBuilder& builder) {
for (uint j = 0; j < 4; j++) {
item.emission[j] = def.emission[j];
}
stats.totalItems++;
}
}
}
@@ -334,6 +338,7 @@ void ContentLoader::load(ContentBuilder& builder) {
std::string name = itemsarr->str(i);
std::string full = pack->id+":"+name;
loadItem(builder.createItem(full), full, name);
stats.totalItems++;
}
}
}