Fix drinking a potion never depleting it

This commit is contained in:
Wuzzy 2020-08-13 18:16:53 +02:00
parent 12ca804488
commit cef20edd53
1 changed files with 6 additions and 2 deletions

View File

@ -62,8 +62,12 @@ function return_on_use(def, effect, dur)
end
def.on_use(user, effect, dur)
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
mcl_potions._use_potion(itemstack, user, def.color)
local old_name, old_count = itemstack:get_name(), itemstack:get_count()
itemstack = minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
if old_name ~= itemstack:get_name() or old_count ~= itemstack:get_count() then
mcl_potions._use_potion(itemstack, user, def.color)
end
return itemstack
end
end