From 469c3bf70b51503bd228e0c1c2ed5197d969a28f Mon Sep 17 00:00:00 2001 From: luk3yx Date: Tue, 16 Apr 2024 21:35:19 +1200 Subject: [PATCH] Ignore unknown nodes when loading in saves --- worldedit/serialization.lua | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/worldedit/serialization.lua b/worldedit/serialization.lua index c79c2a4..ea01fd1 100644 --- a/worldedit/serialization.lua +++ b/worldedit/serialization.lua @@ -251,12 +251,15 @@ function worldedit.deserialize(origin_pos, value) local origin_x, origin_y, origin_z = origin_pos.x, origin_pos.y, origin_pos.z local add_node, get_meta = minetest.add_node, minetest.get_meta + local registered_nodes = minetest.registered_nodes for i, entry in ipairs(nodes) do - entry.x, entry.y, entry.z = origin_x + entry.x, origin_y + entry.y, origin_z + entry.z - -- Entry acts as both position and node - add_node(entry, entry) - if entry.meta then - get_meta(entry):from_table(entry.meta) + if registered_nodes[entry.name] then + entry.x, entry.y, entry.z = origin_x + entry.x, origin_y + entry.y, origin_z + entry.z + -- Entry acts as both position and node + add_node(entry, entry) + if entry.meta then + get_meta(entry):from_table(entry.meta) + end end end return #nodes