From 7e832dc641536c34d50a8f3a8c6a9abd495b8bb2 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Wed, 28 Aug 2024 06:17:53 -0500 Subject: [PATCH 1/2] Fix adding water bottles and emptying full cauldrons --- mods/ITEMS/mcl_buckets/init.lua | 2 +- mods/ITEMS/mcl_potions/init.lua | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/mods/ITEMS/mcl_buckets/init.lua b/mods/ITEMS/mcl_buckets/init.lua index 6aebbc759..3783d65d7 100644 --- a/mods/ITEMS/mcl_buckets/init.lua +++ b/mods/ITEMS/mcl_buckets/init.lua @@ -209,7 +209,7 @@ local function on_place_bucket_empty(itemstack, user, pointed_thing) -- Call on_rightclick if the pointed node defines it local new_stack = mcl_util.call_on_rightclick(itemstack, user, pointed_thing) - if new_stack then + if new_stack and new_stack ~= itemstack then return new_stack end diff --git a/mods/ITEMS/mcl_potions/init.lua b/mods/ITEMS/mcl_potions/init.lua index 446f6ef16..7926cbe36 100644 --- a/mods/ITEMS/mcl_potions/init.lua +++ b/mods/ITEMS/mcl_potions/init.lua @@ -226,10 +226,9 @@ local function water_bottle_on_place(itemstack, placer, pointed_thing) local def = minetest.registered_nodes[node.name] -- Call on_rightclick if the pointed node defines it - if placer and not placer:get_player_control().sneak then - if def and def.on_rightclick then - return def.on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack - end + local new_stack = mcl_util.call_on_rightclick(itemstack, placer, pointed_thing) + if new_stack and new_stack ~= itemstack then + return new_stack end local cauldron = nil @@ -239,11 +238,10 @@ local function water_bottle_on_place(itemstack, placer, pointed_thing) cauldron = fill_cauldron(node.name, "mclx_core:river_water_source") end - if cauldron then - set_node_empty_bottle(itemstack, placer, pointed_thing, cauldron) + return set_node_empty_bottle(itemstack, placer, pointed_thing, cauldron) elseif node.name == "mcl_core:dirt" or node.name == "mcl_core:coarse_dirt" then - set_node_empty_bottle(itemstack, placer, pointed_thing, "mcl_mud:mud") + return set_node_empty_bottle(itemstack, placer, pointed_thing, "mcl_mud:mud") end end From 5b039f1855ef32d5b616fe20b157b5a6a432343c Mon Sep 17 00:00:00 2001 From: teknomunk Date: Wed, 28 Aug 2024 06:30:12 -0500 Subject: [PATCH 2/2] Fix getting water back into bottle --- mods/ITEMS/mcl_potions/init.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mods/ITEMS/mcl_potions/init.lua b/mods/ITEMS/mcl_potions/init.lua index 7926cbe36..3d00d2801 100644 --- a/mods/ITEMS/mcl_potions/init.lua +++ b/mods/ITEMS/mcl_potions/init.lua @@ -61,10 +61,9 @@ minetest.register_craftitem("mcl_potions:glass_bottle", { local def = minetest.registered_nodes[node.name] -- Call on_rightclick if the pointed node defines it - if placer and not placer:get_player_control().sneak then - if def and def.on_rightclick then - return def.on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack - end + local new_stack = mcl_util.call_on_rightclick(itemstack, placer, pointed_thing) + if new_stack and new_stack ~= itemstack then + return new_stack end -- Try to fill glass bottle with water