From 6ebae965f65a841c0a809a05f112e42b30671499 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Thu, 18 Mar 2021 19:27:43 +0100 Subject: [PATCH] fixes --- mods/ITEMS/mcl_cauldrons/init.lua | 20 ++++++++++++++++++-- mods/ITEMS/mcl_potions/init.lua | 4 +++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_cauldrons/init.lua b/mods/ITEMS/mcl_cauldrons/init.lua index fb3e9d366..8485471a8 100644 --- a/mods/ITEMS/mcl_cauldrons/init.lua +++ b/mods/ITEMS/mcl_cauldrons/init.lua @@ -107,9 +107,25 @@ function mcl_cauldrons.take_small_cauldron(pos, itemstack, user, sounds) local number = mcl_cauldrons.add_cauldron_level(pos, mcl_cauldrons.registered_cauldrons[nn.name].name, -1) if number ~= 0 then if sounds then minetest.sound_play(sounds.dug, {gain=1.0, pos = pos, pitch = 1 + math.random(-10, 10)*0.005}, true) end - return ItemStack(mcl_cauldrons.registered_cauldrons[nn.name].bottle) + local item_name = mcl_cauldrons.registered_cauldrons[nn.name].bottle + local inv = placer:get_inventory() + minetest.sound_play("mcl_potions_bottle_fill", {pos=pointed_thing.under, gain=0.5, max_hear_range=16}, true) + if minetest.is_creative_enabled(placer:get_player_name()) then + -- Don't replace empty bottle in creative for convenience reasons + if not inv:contains_item("main", water_bottle) then + inv:add_item("main", water_bottle) + end + elseif itemstack:get_count() == 1 then + return water_bottle + else + if inv:room_for_item("main", water_bottle) then + inv:add_item("main", water_bottle) + else + minetest.add_item(placer:get_pos(), water_bottle) + end + itemstack:take_item() + end end - return itemstack else local number = mcl_cauldrons.add_cauldron_level(pos, mcl_cauldrons.registered_cauldrons[nn.name].name, -1) if number ~= 0 then diff --git a/mods/ITEMS/mcl_potions/init.lua b/mods/ITEMS/mcl_potions/init.lua index df9d2803c..b41cd7c13 100644 --- a/mods/ITEMS/mcl_potions/init.lua +++ b/mods/ITEMS/mcl_potions/init.lua @@ -81,7 +81,9 @@ minetest.register_craftitem("mcl_potions:glass_bottle", { minetest.record_protection_violation(pointed_thing.under, pname) return itemstack end - local itemstack = mcl_cauldrons.take_small_cauldron(pointed_thing.under, itemstack, placer, {dug = "mcl_potions_bottle_fill"}) + local added = mcl_cauldrons.take_small_cauldron(pointed_thing.under, itemstack, placer, {dug = "mcl_potions_bottle_fill"}) + if added == itemstack then + end if get_water then local water_bottle if river_water then