1
0
Fork 0

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
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
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()
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
if not inv:contains_item("main", water_bottle) then
inv:add_item("main", water_bottle)
@ -132,8 +131,6 @@ minetest.register_craftitem("mcl_potions:glass_bottle", {
itemstack:take_item()
end
end
minetest.sound_play("mcl_potions_bottle_fill", {pos=pointed_thing.under, gain=0.5, max_hear_range=16}, true)
end
end
return itemstack
end,