Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Pulls all items of the target item
- -- except for 1 Stack out of the
- -- inventory in front of the turtle
- -- and places it in the inventory
- -- behind the turtle
- local TARGET_ITEM = "minecraft:blaze_rod"
- local supplyChest = peripheral.wrap("front")
- local targetChest = peripheral.wrap("back")
- function transferItems()
- local firstFoundSlot = 0
- for slot, item in pairs(supplyChest.list()) do
- if item.name == TARGET_ITEM then
- if firstFoundSlot == 0 then
- firstFoundSlot = slot
- else
- supplyChest.pushItems(peripheral.getName(targetChest), slot)
- end
- end
- end
- end
- if supplyChest == nil then
- print("No supply chain found in front of the turtle")
- elseif targetChest == nil then
- print("No target chest found behind the turtle")
- else
- term.clear()
- term.setCursorPos(1, 1)
- term.write("Transfering items...")
- -- loop transfer
- while true do
- transferItems()
- sleep(1)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement