mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-11 14:01:49 +00:00
add explicit block fields total size limit - 240 bytes
This commit is contained in:
parent
221a34fa2e
commit
e0a4876f3f
2 changed files with 9 additions and 0 deletions
|
|
@ -255,6 +255,13 @@ void ContentLoader::loadBlock(
|
||||||
if (root.has("fields")) {
|
if (root.has("fields")) {
|
||||||
def.dataStruct = std::make_unique<data::StructLayout>();
|
def.dataStruct = std::make_unique<data::StructLayout>();
|
||||||
def.dataStruct->deserialize(root["fields"]);
|
def.dataStruct->deserialize(root["fields"]);
|
||||||
|
if (def.dataStruct->size() > MAX_BLOCK_FIELDS_SIZE) {
|
||||||
|
throw std::runtime_error(
|
||||||
|
util::quote(def.name) +
|
||||||
|
" fields total size exceeds limit (" +
|
||||||
|
std::to_string(def.dataStruct->size()) + "/" +
|
||||||
|
std::to_string(MAX_BLOCK_FIELDS_SIZE) + ")");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (def.tickInterval == 0) {
|
if (def.tickInterval == 0) {
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,8 @@ inline constexpr uint FACE_PZ = 5;
|
||||||
/// complex hitboxes
|
/// complex hitboxes
|
||||||
inline constexpr uint BLOCK_AABB_GRID = 16;
|
inline constexpr uint BLOCK_AABB_GRID = 16;
|
||||||
|
|
||||||
|
inline constexpr size_t MAX_BLOCK_FIELDS_SIZE = 240;
|
||||||
|
|
||||||
inline std::string DEFAULT_MATERIAL = "base:stone";
|
inline std::string DEFAULT_MATERIAL = "base:stone";
|
||||||
|
|
||||||
struct block_funcs_set {
|
struct block_funcs_set {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue