From 132db020114e41940677aa38bbad83ca7c32bbe4 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 11 Nov 2020 21:00:37 +0100 Subject: [PATCH] Sugarcane less strict w/ water check on place --- mods/ITEMS/mcl_core/nodes_cactuscane.lua | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/mods/ITEMS/mcl_core/nodes_cactuscane.lua b/mods/ITEMS/mcl_core/nodes_cactuscane.lua index 277cc565f..f914a6e6b 100644 --- a/mods/ITEMS/mcl_core/nodes_cactuscane.lua +++ b/mods/ITEMS/mcl_core/nodes_cactuscane.lua @@ -93,18 +93,14 @@ minetest.register_node("mcl_core:reeds", { return false end - local posses = { - { x=0, y=0, z=1}, - { x=0, y=0, z=-1}, - { x=1, y=0, z=0}, - { x=-1, y=0, z=0}, - } - for p=1, #posses do - local checknode = minetest.get_node(vector.add(soil_pos, posses[p])) - if minetest.get_item_group(checknode.name, "water") ~= 0 or minetest.get_item_group(checknode.name, "frosted_ice") ~= 0 then - -- Water found! Sugar canes are happy! :-) - return true - end + -- Legal water position rules are the same as for decoration spawn_by rules. + -- This differs from MC, which does not allow diagonal neighbors + -- and neighbors 1 layer above. + local np1 = {x=soil_pos.x-1, y=soil_pos.y, z=soil_pos.z-1} + local np2 = {x=soil_pos.x+1, y=soil_pos.y+1, z=soil_pos.z+1} + if #minetest.find_nodes_in_area(np1, np2, {"group:water", "group:frosted_ice"}) > 0 then + -- Water found! Sugar canes are happy! :-) + return true end -- No water found! Sugar canes are not amuzed and refuses to be placed. :-(