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,34 +105,31 @@ 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()) local water_bottle
if from_liquid_source or creative then if river_water then
-- Replace with water bottle, if possible, otherwise water_bottle = ItemStack("mcl_potions:river_water")
-- place the water potion at a place where's space else
local water_bottle water_bottle = ItemStack("mcl_potions:water")
if river_water then
water_bottle = ItemStack("mcl_potions:river_water")
else
water_bottle = ItemStack("mcl_potions:water")
end
local inv = placer:get_inventory()
if creative 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 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) 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 end
end end
return itemstack return itemstack