{"record":{"id":"7a61e032a30d8f3b","repo":"Anuken/Mindustry","slug":"blocks-cannot-be-larger-than-maxblocksize","errorCode":null,"errorMessage":"Blocks cannot be larger than ${maxBlockSize}","messagePattern":"Blocks cannot be larger than (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/src/mindustry/mod/ContentParser.java","lineNumber":605,"sourceCode":"                }else{\n                    block = locate(ContentType.block, name);\n                }\n            }else{\n                block = make(resolve(value.getString(\"type\", \"Block\"), allowPatching ? Block.class : null), mod + \"-\" + name);\n            }\n\n            currentContent = block;\n\n            read(() -> {\n                if(value.has(\"consumes\") && value.get(\"consumes\").isObject()){\n                    readBlockConsumers(block, value.get(\"consumes\"));\n                    value.remove(\"consumes\");\n                }\n\n                readFields(block, value, true);\n\n                if(block.size > maxBlockSize){\n                    throw new IllegalArgumentException(\"Blocks cannot be larger than \" + maxBlockSize);\n                }\n\n                //make block visible by default if there are requirements and no visibility set\n                if(value.has(\"requirements\") && block.buildVisibility == BuildVisibility.hidden){\n                    block.buildVisibility = BuildVisibility.shown;\n                }\n            });\n\n            return block;\n        },\n        ContentType.unit, (TypeParser<UnitType>)(mod, name, value) -> {\n            readBundle(ContentType.unit, name, value);\n\n            UnitType unit;\n            if(!allowPatching || locate(ContentType.unit, name) == null){\n\n                unit = make(resolve(value.getString(\"template\", \"\"), UnitType.class), mod + \"-\" + name);\n","sourceCodeStart":587,"sourceCodeEnd":623,"githubUrl":"https://github.com/Anuken/Mindustry/blob/f695ad7e60323ebced984fa26d0bcf0bc54296b4/core/src/mindustry/mod/ContentParser.java#L587-L623","documentation":"After readFields() populates a block from JSON, the parser verifies block.size does not exceed maxBlockSize (defined as 16 in Vars.java:103). A block larger than the engine maximum is rejected because rendering, edge caching (Edges.java uses maxBlockSize-sized arrays), and ConstructBlock allocation cannot accommodate it.","triggerScenarios":"A mod block JSON sets \"size\" to an integer greater than 16 (e.g. a mega-factory at size 20). The check runs inside the block TypeParser's read() after fields are applied.","commonSituations":"Authoring oversized multi-block structures; assuming the limit is higher than 16; porting a mod from a fork that raised the cap.","solutions":["Set \"size\" to 16 or less in the block JSON.","If a genuinely larger footprint is required, split the structure into multiple adjacent blocks.","Do not attempt to raise Vars.maxBlockSize in a mod — it is final and baked into static arrays."],"exampleFix":"// before\n\"size\": 24\n// after\n\"size\": 12","handlingStrategy":"validation","validationCode":"// Reject oversized blocks before parse.\nif(value.has(\"size\") && value.getInt(\"size\", 0) > 16){\n    throw new IllegalStateException(\"Block size \" + value.getInt(\"size\") + \" exceeds maxBlockSize 16\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat 16 as a hard ceiling when designing multi-blocks.","Document the limit in your mod authoring guide."],"tags":["mindustry","modding","json","content-parser","block","size-limit"],"backgroundTag":null,"analyzedSha":"f695ad7e60323ebced984fa26d0bcf0bc54296b4","analyzedAt":"2026-08-14T04:31:16.262Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}