From 15fa3ff7751a1c089e5e507f5c64ed9bfbe33f57 Mon Sep 17 00:00:00 2001 From: cora Date: Fri, 3 Nov 2023 15:22:19 +0100 Subject: [PATCH] Fix crash when growing kelp into water logged mangrove roots --- mods/ITEMS/mcl_mangrove/init.lua | 2 +- mods/ITEMS/mcl_ocean/kelp.lua | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_mangrove/init.lua b/mods/ITEMS/mcl_mangrove/init.lua index ba20ac2a6..a192b2ffc 100644 --- a/mods/ITEMS/mcl_mangrove/init.lua +++ b/mods/ITEMS/mcl_mangrove/init.lua @@ -221,7 +221,7 @@ local wlroots = { liquids_pointable = true, drop = "mcl_mangrove:mangrove_roots", groups = { - handy = 1, hoey = 1, water=3, liquid=3, puts_out_fire=1, dig_by_piston = 1, deco_block = 1, not_in_creative_inventory=1 }, + handy = 1, hoey = 1, water=4, liquid=3, puts_out_fire=1, dig_by_piston = 1, deco_block = 1, not_in_creative_inventory=1 }, _mcl_blast_resistance = 100, _mcl_hardness = -1, -- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode on_construct = function(pos) diff --git a/mods/ITEMS/mcl_ocean/kelp.lua b/mods/ITEMS/mcl_ocean/kelp.lua index 1084dfa77..0b43b9775 100644 --- a/mods/ITEMS/mcl_ocean/kelp.lua +++ b/mods/ITEMS/mcl_ocean/kelp.lua @@ -81,7 +81,8 @@ end -- Is this water? -- Returns the liquidtype, if indeed water. function kelp.is_submerged(node) - if mt_get_item_group(node.name, "water") ~= 0 then + local g = mt_get_item_group(node.name, "water") + if g > 0 and g <= 3 then -- Expected only "source" and "flowing" from water liquids return mt_registered_nodes[node.name].liquidtype end @@ -267,7 +268,7 @@ function kelp.next_height(pos, node, pos_tip, node_tip, submerged, downward_flow -- Flowing liquid: Grow 1 step, but also turn the tip node into a liquid source. if downward_flowing then local alt_liq = mt_registered_nodes[node_tip.name].liquid_alternative_source - if alt_liq then + if alt_liq and mt_registered_nodes[alt_liq] then mt_set_node(pos_tip, {name=alt_liq}) end end