Fix glass bottles remained empty on take water from cauldrons, https://github.com/kay27/MineClone2/issues/1

This commit is contained in:
kay27 2020-09-27 22:56:39 +04:00
parent 339f7c6359
commit a511152cdf
1 changed files with 23 additions and 26 deletions

View File

@ -105,18 +105,17 @@ minetest.register_craftitem("mcl_potions:glass_bottle", {
end end
end end
if get_water then if get_water then
local creative = minetest.is_creative_enabled(placer:get_player_name())
if from_liquid_source or creative then
-- Replace with water bottle, if possible, otherwise
-- place the water potion at a place where's space
local water_bottle local water_bottle
if river_water then if river_water then
water_bottle = ItemStack("mcl_potions:river_water") water_bottle = ItemStack("mcl_potions:river_water")
else else
water_bottle = ItemStack("mcl_potions:water") water_bottle = ItemStack("mcl_potions:water")
end end
-- Replace with water bottle, if possible, otherwise
-- place the water potion at a place where's space
local inv = placer:get_inventory() local inv = placer:get_inventory()
if creative then 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 -- Don't replace empty bottle in creative for convenience reasons
if not inv:contains_item("main", water_bottle) then if not inv:contains_item("main", water_bottle) then
inv:add_item("main", water_bottle) inv:add_item("main", water_bottle)
@ -132,8 +131,6 @@ minetest.register_craftitem("mcl_potions:glass_bottle", {
itemstack:take_item() itemstack:take_item()
end end
end end
minetest.sound_play("mcl_potions_bottle_fill", {pos=pointed_thing.under, gain=0.5, max_hear_range=16}, true)
end
end end
return itemstack return itemstack
end, end,