blocks and items 'caption' property

This commit is contained in:
MihailRis
2024-03-12 16:59:34 +03:00
parent c9da6b9a0c
commit 5c3b61265a
10 changed files with 44 additions and 1 deletions
+5
View File
@@ -107,6 +107,8 @@ void ContentLoader::fixPackIndices() {
void ContentLoader::loadBlock(Block& def, std::string name, fs::path file) {
auto root = files::read_json(file);
root->str("caption", def.caption);
// block texturing
if (root->has("texture")) {
std::string texture;
@@ -253,6 +255,8 @@ void ContentLoader::loadCustomBlockModel(Block& def, dynamic::Map* primitives) {
void ContentLoader::loadItem(ItemDef& def, std::string name, fs::path file) {
auto root = files::read_json(file);
root->str("caption", def.caption);
std::string iconTypeStr = "";
root->str("icon-type", iconTypeStr);
if (iconTypeStr == "none") {
@@ -346,6 +350,7 @@ void ContentLoader::load(ContentBuilder& builder) {
if (!def.hidden) {
auto& item = builder.createItem(full+BLOCK_ITEM_SUFFIX);
item.generated = true;
item.caption = def.caption;
item.iconType = item_icon_type::block;
item.icon = full;
item.placingBlock = full;