From e8b2732692aff992737018af13854baa5b96e564 Mon Sep 17 00:00:00 2001 From: MayaTheShy Date: Mon, 16 Mar 2026 18:33:16 -0400 Subject: [PATCH] Update client barrel auto-sort to trigger only when items are present --- inventoryClient.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/inventoryClient.lua b/inventoryClient.lua index 1bbc082..205ea7d 100644 --- a/inventoryClient.lua +++ b/inventoryClient.lua @@ -1384,12 +1384,18 @@ local function main() end end, - -- Task 4: Client barrel auto-sort (sends to master) + -- Task 4: Client barrel auto-sort (sends to master only when barrel has items) function() if CLIENT_BARREL_NAME == "" then return end print("[OK] Client barrel: " .. CLIENT_BARREL_NAME) while true do - sendToMaster({ type = "sort_barrel", barrelName = CLIENT_BARREL_NAME }) + local barrel = peripheral.wrap(CLIENT_BARREL_NAME) + if barrel then + local contents = barrel.list() + if contents and next(contents) then + sendToMaster({ type = "sort_barrel", barrelName = CLIENT_BARREL_NAME }) + end + end sleep(2) end end,