From 6218e5884d74646d074f84901abf379d96da5ec7 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Wed, 3 Apr 2019 11:10:59 -0700 Subject: [PATCH] Limit areas to -30992,30992 due to MABLOCK_SIZE=16 Internally, when allocating an AreaStore, the limits are required to be within the last full block, and so, you cannot create one "on" the edge, as it will trigger an exception. When limited to the last full mapblock, it all works fine. --- pos.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pos.lua b/pos.lua index be0ef20..36a6b78 100644 --- a/pos.lua +++ b/pos.lua @@ -11,11 +11,13 @@ areas.set_pos = {} areas.pos1 = {} areas.pos2 = {} +local LIMIT = 30992 -- this is due to MAPBLOCK_SIZE=16! + local function posLimit(pos) return { - x = math.max(math.min(pos.x, 31000), -31000), - y = math.max(math.min(pos.y, 31000), -31000), - z = math.max(math.min(pos.z, 31000), -31000) + x = math.max(math.min(pos.x, LIMIT), -LIMIT), + y = math.max(math.min(pos.y, LIMIT), -LIMIT), + z = math.max(math.min(pos.z, LIMIT), -LIMIT) } end