
local has_br_survival = core.get_modpath("br_survival") ~= nil
function br_core.food_on_rightclick(itemstack, clicker, pointed_thing)
    local ret = aom_util.try_rightclick(itemstack, clicker, pointed_thing, false)
    if ret then
        return ret
    end
    if not core.is_player(clicker) then return end
	local player = clicker
    local idef = itemstack:get_definition()
    if has_br_survival and idef._thirst then
        br_survival.add_stat(player, "thirst", -idef._thirst)
    end
    if has_br_survival and idef._hunger then
        br_survival.add_stat(player, "hunger", -idef._hunger)
    end
    if core.is_creative_enabled(player:get_player_name()) then return end
    itemstack:take_item(1)
    if idef._empty_item then
        if itemstack:get_count() <= 0 then
            itemstack = ItemStack(idef._empty_item)
        else
            local leftover = ItemStack(idef._empty_item)
            leftover = player:get_inventory():add_item("main", leftover) or leftover
            if leftover and leftover:get_count() > 0 then
                core.add_item(player:get_pos(), leftover)
            end
        end
    end
    return itemstack
end
