From 59b013f766dbaedbda47223682321479bacfa5e4 Mon Sep 17 00:00:00 2001 From: Alexander Minges Date: Tue, 28 Apr 2020 16:32:28 +0200 Subject: [PATCH] Grow uncarved pumpkin from seeds instead of carved Carved pumpkin has to be explicitly registered as a separate node, as registering a carved pumpkin node happened as a side effect of invoking mcl_farming:add_gourd() for the carved pumpkin. The iron / snow golem spawning checks that trigger whenever a carved pumpkin is placed had to be moved out of the mcl_farming:add_gourd() invocation to preserve the existing behaviour. Note that uncarved pumpkin must not be registered as a separate node, as invoking mcl_farming:add_gourd() for a registered node name leads to stems not updating when an adjacent node is manually placed or mined. --- mods/ITEMS/mcl_farming/pumpkin.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mods/ITEMS/mcl_farming/pumpkin.lua b/mods/ITEMS/mcl_farming/pumpkin.lua index 72b4e541..12044450 100644 --- a/mods/ITEMS/mcl_farming/pumpkin.lua +++ b/mods/ITEMS/mcl_farming/pumpkin.lua @@ -104,7 +104,6 @@ local pumpkin_base_def = { _mcl_blast_resistance = 1, _mcl_hardness = 1, } -minetest.register_node("mcl_farming:pumpkin", pumpkin_base_def) local pumpkin_face_base_def = table.copy(pumpkin_base_def) pumpkin_face_base_def.description = S("Pumpkin") @@ -115,20 +114,21 @@ pumpkin_face_base_def.groups.armor_head=1 pumpkin_face_base_def._mcl_armor_mob_range_factor = 0 pumpkin_face_base_def._mcl_armor_mob_range_mob = "mobs_mc:enderman" pumpkin_face_base_def.groups.non_combat_armor=1 +pumpkin_face_base_def.on_construct = function(pos) + -- Attempt to spawn iron golem or snow golem + mobs_mc.tools.check_iron_golem_summon(pos) + mobs_mc.tools.check_snow_golem_summon(pos) +end if minetest.get_modpath("mcl_armor") then pumpkin_face_base_def.on_secondary_use = armor.on_armor_use end +minetest.register_node("mcl_farming:pumpkin_face", pumpkin_face_base_def) -- Register stem growth mcl_farming:add_plant("plant_pumpkin_stem", "mcl_farming:pumpkintige_unconnect", {"mcl_farming:pumpkin_1", "mcl_farming:pumpkin_2", "mcl_farming:pumpkin_3", "mcl_farming:pumpkin_4", "mcl_farming:pumpkin_5", "mcl_farming:pumpkin_6", "mcl_farming:pumpkin_7"}, 30, 5) -- Register actual pumpkin, connected stems and stem-to-pumpkin growth -mcl_farming:add_gourd("mcl_farming:pumpkintige_unconnect", "mcl_farming:pumpkintige_linked", "mcl_farming:pumpkintige_unconnect", stem_def, stem_drop, "mcl_farming:pumpkin_face", pumpkin_face_base_def, 30, 15, "mcl_farming_pumpkin_stem_connected.png^[colorize:#FFA800:127", -function(pos) - -- Attempt to spawn iron golem or snow golem - mobs_mc.tools.check_iron_golem_summon(pos) - mobs_mc.tools.check_snow_golem_summon(pos) -end) +mcl_farming:add_gourd("mcl_farming:pumpkintige_unconnect", "mcl_farming:pumpkintige_linked", "mcl_farming:pumpkintige_unconnect", stem_def, stem_drop, "mcl_farming:pumpkin", pumpkin_base_def, 30, 15, "mcl_farming_pumpkin_stem_connected.png^[colorize:#FFA800:127") -- Jack o'Lantern minetest.register_node("mcl_farming:pumpkin_face_light", {