This commit is contained in:
AFCMS 2021-03-18 19:27:43 +01:00
parent 5e5b3ebf75
commit 6ebae965f6
2 changed files with 21 additions and 3 deletions

View File

@ -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

View File

@ -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