mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 11:01:49 +00:00
contentpack remove feature WIP
This commit is contained in:
parent
a1f313bedc
commit
3862dbda66
18 changed files with 541 additions and 433 deletions
|
|
@ -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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue