minetest-mods / i3

:rocket: A next-generation inventory for Minetest 5.6+
Other
41 stars 26 forks source link

Add API for adding footer buttons #99

Open OgelGames opened 1 year ago

OgelGames commented 1 year ago

Currently the footer buttons (trash, sort, settings, home) are hard coded, and there is no API to add more buttons.

My use case is to add a "quick stack to nearby chests" button, which is easy to do with unified_inventory, but impossible with i3.

The API would be similar to adding tabs, something like this:

i3.new_button("button", {
    description = "Button",
    image = "button.png",
    -- Called when the button is pressed
    action = function(player, data)
        local name = player:get_player_name()
        minetest.chat_send_player(name, "You pressed the button!")
    end,
})