fix block overriding
This commit is contained in:
@@ -220,11 +220,11 @@ void ContentLoader::loadBlock(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// block model
|
// block model
|
||||||
std::string modelTypeName;
|
std::string modelTypeName = to_string(def.model);
|
||||||
root.at("model").get(modelTypeName);
|
root.at("model").get(modelTypeName);
|
||||||
root.at("model-name").get(def.modelName);
|
root.at("model-name").get(def.modelName);
|
||||||
if (auto model = BlockModel_from(modelTypeName)) {
|
if (auto model = BlockModel_from(modelTypeName)) {
|
||||||
if (*model == BlockModel::custom) {
|
if (*model == BlockModel::custom && def.customModelRaw == nullptr) {
|
||||||
if (root.has("model-primitives")) {
|
if (root.has("model-primitives")) {
|
||||||
def.customModelRaw = root["model-primitives"];
|
def.customModelRaw = root["model-primitives"];
|
||||||
} else if (def.modelName.empty()) {
|
} else if (def.modelName.empty()) {
|
||||||
@@ -246,7 +246,7 @@ void ContentLoader::loadBlock(
|
|||||||
root.at("material").get(def.material);
|
root.at("material").get(def.material);
|
||||||
|
|
||||||
// rotation profile
|
// rotation profile
|
||||||
std::string profile = "none";
|
std::string profile = def.rotations.name;
|
||||||
root.at("rotation").get(profile);
|
root.at("rotation").get(profile);
|
||||||
|
|
||||||
def.rotatable = profile != "none";
|
def.rotatable = profile != "none";
|
||||||
@@ -285,8 +285,6 @@ void ContentLoader::loadBlock(
|
|||||||
);
|
);
|
||||||
aabb.b += aabb.a;
|
aabb.b += aabb.a;
|
||||||
def.hitboxes = {aabb};
|
def.hitboxes = {aabb};
|
||||||
} else {
|
|
||||||
def.hitboxes = {AABB()};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// block light emission [r, g, b] where r,g,b in range [0..15]
|
// block light emission [r, g, b] where r,g,b in range [0..15]
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ public:
|
|||||||
bool translucent = false;
|
bool translucent = false;
|
||||||
|
|
||||||
/// @brief Set of block physical hitboxes
|
/// @brief Set of block physical hitboxes
|
||||||
std::vector<AABB> hitboxes;
|
std::vector<AABB> hitboxes {AABB()};
|
||||||
|
|
||||||
/// @brief Set of available block rotations (coord-systems)
|
/// @brief Set of available block rotations (coord-systems)
|
||||||
BlockRotProfile rotations = BlockRotProfile::NONE;
|
BlockRotProfile rotations = BlockRotProfile::NONE;
|
||||||
|
|||||||
Reference in New Issue
Block a user