diff --git a/smart_sfinv_tweaks/init.lua b/smart_sfinv_tweaks/init.lua index 74d1d0f..1f2387c 100644 --- a/smart_sfinv_tweaks/init.lua +++ b/smart_sfinv_tweaks/init.lua @@ -7,8 +7,15 @@ smart_sfinv_api.defaults.theme_inv = smart_sfinv_api.defaults.theme_inv .. 'tooltip[sfinv_tweaks_rotate;Rotate rows]' +local crafting_enhance = 'image_button[0.5,1.6;0.8,0.8;smart_sfinv_tweaks_sweep_button.png;sfinv_tweaks_sweep;]' .. + 'tooltip[sfinv_tweaks_sweep;Sweep crafting area]' smart_sfinv_api.register_enhancement({ + make_formspec = function(handler, player, context, content, show_inv) + if context.page == "sfinv:crafting" then + handler.formspec_after_navfs = handler.formspec_after_navfs..crafting_enhance + end + end, receive_fields = function(handler, player, context, fields) if fields.sfinv_tweaks_compress then context.tweaks_inv = context.tweaks_inv or maininv.get(player) @@ -18,6 +25,10 @@ smart_sfinv_api.register_enhancement({ context.tweaks_inv = context.tweaks_inv or maininv.get(player) context.tweaks_inv:rotate_rows() end + if fields.sfinv_tweaks_sweep then + context.tweaks_inv = context.tweaks_inv or maininv.get(player) + context.tweaks_inv:sweep_crafting_inventory() + end end }) diff --git a/smart_sfinv_tweaks/textures/smart_sfinv_tweaks_sweep_button.png b/smart_sfinv_tweaks/textures/smart_sfinv_tweaks_sweep_button.png new file mode 100644 index 0000000..2f79fd0 Binary files /dev/null and b/smart_sfinv_tweaks/textures/smart_sfinv_tweaks_sweep_button.png differ