quick fix

This commit is contained in:
AFCMS 2021-03-18 19:30:53 +01:00
parent 6ebae965f6
commit 3c83898095
2 changed files with 8 additions and 36 deletions

View File

@ -78,7 +78,7 @@ function mcl_cauldrons.get_cauldron_level(pos)
end
function mcl_cauldrons.is_cauldron(name)
return minetest.get_item_group(nn.name, "cauldron") ~= 0
return minetest.get_item_group(name, "cauldron") ~= 0
end
function mcl_cauldrons.take_cauldron(pos, itemstack, user, sounds)
@ -112,16 +112,16 @@ function mcl_cauldrons.take_small_cauldron(pos, itemstack, user, sounds)
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)
if not inv:contains_item("main", item_name) then
inv:add_item("main", item_name)
end
elseif itemstack:get_count() == 1 then
return water_bottle
return item_name
else
if inv:room_for_item("main", water_bottle) then
inv:add_item("main", water_bottle)
if inv:room_for_item("main", item_name) then
inv:add_item("main", item_name)
else
minetest.add_item(placer:get_pos(), water_bottle)
minetest.add_item(placer:get_pos(), item_name)
end
itemstack:take_item()
end

View File

@ -81,35 +81,7 @@ minetest.register_craftitem("mcl_potions:glass_bottle", {
minetest.record_protection_violation(pointed_thing.under, pname)
return itemstack
end
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
water_bottle = ItemStack("mcl_potions:river_water")
else
water_bottle = ItemStack("mcl_potions:water")
end
-- Replace with water bottle, if possible, otherwise
-- place the water potion at a place where's space
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
mcl_cauldrons.take_small_cauldron(pointed_thing.under, itemstack, placer, {dug = "mcl_potions_bottle_fill"})
end
end
return itemstack