voxelcore/src/content/ContentLoader.hpp
REDxEYE 5f6ae5daba ItemDef/EntityDef/Block: Add method cloneTo to definition to other definition
ContentBuilder: Add method `get` to get definition or nullptr
ContentLoader: Add functionality to clone from definition specified in `parent` field in json
2024-08-20 21:58:01 +03:00

65 lines
1.6 KiB
C++

#pragma once
#include <filesystem>
#include <memory>
#include <string>
#include "content_fwd.hpp"
namespace fs = std::filesystem;
class Block;
struct BlockMaterial;
struct ItemDef;
struct EntityDef;
struct ContentPack;
class ContentBuilder;
class ContentPackRuntime;
struct ContentPackStats;
namespace dynamic {
class Map;
class List;
}
class ContentLoader {
const ContentPack* pack;
ContentPackRuntime* runtime;
scriptenv env;
ContentBuilder& builder;
ContentPackStats* stats;
void loadBlock(
Block& def, const std::string& full, const std::string& name
);
void loadItem(
ItemDef& def, const std::string& full, const std::string& name
);
void loadEntity(
EntityDef& def, const std::string& full, const std::string& name
);
static void loadCustomBlockModel(Block& def, dynamic::Map* primitives);
static void loadBlockMaterial(BlockMaterial& def, const fs::path& file);
void loadBlock(
Block& def, const std::string& name, const fs::path& file
);
void loadItem(
ItemDef& def, const std::string& name, const fs::path& file
);
void loadEntity(
EntityDef& def, const std::string& name, const fs::path& file
);
void loadResources(ResourceType type, dynamic::List* list);
public:
ContentLoader(ContentPack* pack, ContentBuilder& builder);
bool fixPackIndices(
const fs::path& folder,
dynamic::Map* indicesRoot,
const std::string& contentSection
);
void fixPackIndices();
void load();
};