1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2024-12-23 00:20:17 +01:00

Merge branch 'beer-fix' into 'master'

Use API to replace beer mug

Closes #18

See merge request VanessaE/homedecor_modpack!5
This commit is contained in:
Vanessa Dannenberg 2019-08-21 21:33:30 +00:00
commit daef49a255

View File

@ -164,18 +164,7 @@ homedecor.register("beer_mug", {
on_use = function(itemstack, user, pointed_thing) on_use = function(itemstack, user, pointed_thing)
local inv = user:get_inventory() local inv = user:get_inventory()
if not creative.is_enabled_for(user:get_player_name()) then if not creative.is_enabled_for(user:get_player_name()) then
if inv:room_for_item("main", "vessels:drinking_glass 1") then minetest.do_item_eat(2, "vessels:drinking_glass 1", itemstack, user, pointed_thing)
inv:add_item("main", "vessels:drinking_glass 1")
else
local pos = user:get_pos()
local dir = user:get_look_dir()
local fdir = minetest.dir_to_facedir(dir)
local pos_fwd = { x = pos.x + homedecor.fdir_to_fwd[fdir+1][1],
y = pos.y + 1,
z = pos.z + homedecor.fdir_to_fwd[fdir+1][2] }
minetest.add_item(pos_fwd, "vessels:drinking_glass 1")
end
minetest.do_item_eat(2, nil, itemstack, user, pointed_thing)
return itemstack return itemstack
end end
end end