mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-14 07:21:51 +00:00
fix: missing extended block size limit check
This commit is contained in:
parent
9eb85bd2dd
commit
9628177698
2 changed files with 18 additions and 2 deletions
|
|
@ -33,6 +33,8 @@ inline constexpr int CHUNK_W = 16;
|
||||||
inline constexpr int CHUNK_H = 256;
|
inline constexpr int CHUNK_H = 256;
|
||||||
inline constexpr int CHUNK_D = 16;
|
inline constexpr int CHUNK_D = 16;
|
||||||
|
|
||||||
|
inline constexpr int EXTENDED_BLOCK_LIMIT = CHUNK_W; // must not be greater than chunk width and depth
|
||||||
|
|
||||||
inline constexpr uint VOXEL_USER_BITS = 8;
|
inline constexpr uint VOXEL_USER_BITS = 8;
|
||||||
inline constexpr uint VOXEL_USER_BITS_OFFSET = sizeof(blockstate_t)*8-VOXEL_USER_BITS;
|
inline constexpr uint VOXEL_USER_BITS_OFFSET = sizeof(blockstate_t)*8-VOXEL_USER_BITS;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
#include "presets/ParticlesPreset.hpp"
|
#include "presets/ParticlesPreset.hpp"
|
||||||
#include "util/stringutil.hpp"
|
#include "util/stringutil.hpp"
|
||||||
#include "voxels/Block.hpp"
|
#include "voxels/Block.hpp"
|
||||||
|
#include "constants.hpp"
|
||||||
|
|
||||||
using namespace data;
|
using namespace data;
|
||||||
|
|
||||||
|
|
@ -184,7 +185,11 @@ template<> void ContentUnitLoader<Block>::loadUnit(
|
||||||
if (auto found = root.at("emission")) {
|
if (auto found = root.at("emission")) {
|
||||||
const auto& emissionarr = *found;
|
const auto& emissionarr = *found;
|
||||||
for (size_t i = 0; i < 3; i++) {
|
for (size_t i = 0; i < 3; i++) {
|
||||||
def.emission[i] = glm::clamp(emissionarr[i].asInteger(), static_cast<integer_t>(0), static_cast<integer_t>(15));
|
def.emission[i] = glm::clamp(
|
||||||
|
emissionarr[i].asInteger(),
|
||||||
|
static_cast<integer_t>(0),
|
||||||
|
static_cast<integer_t>(15)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -200,6 +205,15 @@ template<> void ContentUnitLoader<Block>::loadUnit(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (def.size.x > EXTENDED_BLOCK_LIMIT ||
|
||||||
|
def.size.y > EXTENDED_BLOCK_LIMIT ||
|
||||||
|
def.size.z > EXTENDED_BLOCK_LIMIT) {
|
||||||
|
throw std::runtime_error(
|
||||||
|
"extended block " + util::quote(def.name) + " size limit " +
|
||||||
|
std::to_string(EXTENDED_BLOCK_LIMIT) + " exceeded"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// should variant modify hitbox?
|
// should variant modify hitbox?
|
||||||
if (def.defaults.model.type == BlockModelType::BLOCK &&
|
if (def.defaults.model.type == BlockModelType::BLOCK &&
|
||||||
(def.size.x != 1 || def.size.y != 1 || def.size.z != 1)) {
|
(def.size.x != 1 || def.size.y != 1 || def.size.z != 1)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue