feat: item models generation simple & remove core:item_models
This commit is contained in:
@@ -5,11 +5,13 @@
|
||||
#include <optional>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
#include <typeindex>
|
||||
#include <typeinfo>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "util/stringutil.hpp"
|
||||
#include "graphics/core/TextureAnimation.hpp"
|
||||
|
||||
class Assets;
|
||||
@@ -84,6 +86,15 @@ public:
|
||||
return static_cast<T*>(found->second.get());
|
||||
}
|
||||
|
||||
template <class T>
|
||||
T& require(const std::string& name) const {
|
||||
T* asset = get<T>(name);
|
||||
if (asset == nullptr) {
|
||||
throw std::runtime_error(util::quote(name) + " not found");
|
||||
}
|
||||
return *asset;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
std::optional<const assets_map*> getMap() const {
|
||||
const auto& mapIter = assets.find(typeid(T));
|
||||
|
||||
Reference in New Issue
Block a user