From 25c2c5b53a36a6a6e594119feb3563892f25582f Mon Sep 17 00:00:00 2001 From: Alexander Weber Date: Wed, 12 Jan 2022 21:17:57 +0100 Subject: [PATCH] smart_sfinv_tweaks: Add trash button for creative pages --- smart_sfinv_tweaks/init.lua | 18 +++++++++++++++++- .../smart_sfinv_tweaks_trash_button.png | Bin 0 -> 291 bytes 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 smart_sfinv_tweaks/textures/smart_sfinv_tweaks_trash_button.png diff --git a/smart_sfinv_tweaks/init.lua b/smart_sfinv_tweaks/init.lua index de52353..81fa4b4 100644 --- a/smart_sfinv_tweaks/init.lua +++ b/smart_sfinv_tweaks/init.lua @@ -16,7 +16,7 @@ sfinv_buttons.register_button('compress', { sfinv_buttons.register_button('rotate', { image = "smart_sfinv_tweaks_rotate.png", tooltip = "Rotate inventory rows", - position = 7, + position = 8, action = function(player) maininv.get(player):rotate_rows() end, @@ -25,6 +25,22 @@ sfinv_buttons.register_button('rotate', { end }) +sfinv_buttons.register_button('trash', { + image = "smart_sfinv_tweaks_trash_button.png", + tooltip = "Remove all items from inventory", + position = 9, + action = function(player) + maininv.get(player):remove_all() + end, + show = function(player, context, content, show_inv) + if context.page:sub(1,9) == "creative:" then + return show_inv + else + return false + end + end +}) + 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]' diff --git a/smart_sfinv_tweaks/textures/smart_sfinv_tweaks_trash_button.png b/smart_sfinv_tweaks/textures/smart_sfinv_tweaks_trash_button.png new file mode 100644 index 0000000000000000000000000000000000000000..2ad1e6c85c83ec935418dd8511c1f4678f3e1fe9 GIT binary patch literal 291 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4&HECyrsn$JLrv%n*= zn1O*?7=#%aX3dcR3bL1Y`ns||