Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Define the input and output peripherals
- local inputChest = peripheral.wrap("minecraft:chest_1")
- local outputAltar = peripheral.wrap("summoningrituals:altar_1")
- -- Define the list of required items
- local requiredItems = {
- "minecraft:netherite_scrap",
- "allthemodium:allthemodium_ingot",
- "alltheores:enderium_ingot",
- "megacells:sky_steel_ingot",
- "projecte:aeternalis_fuel_block"
- }
- -- Function to check for required items in the input chest
- local function checkForRequiredItems()
- local itemsFound = {}
- local items = inputChest.list()
- for _, requiredItem in ipairs(requiredItems) do
- itemsFound[requiredItem] = false
- end
- for slot, item in pairs(items) do
- if itemsFound[item.name] == false then
- itemsFound[item.name] = { slot = slot, count = item.count }
- end
- end
- for _, requiredItem in ipairs(requiredItems) do
- if itemsFound[requiredItem] == false then
- print("Missing item: " .. requiredItem)
- return nil
- end
- end
- return itemsFound
- end
- -- Function to transfer items from the input chest to the output altar
- local function transferItems(itemsFound)
- for _, requiredItem in ipairs(requiredItems) do
- local itemInfo = itemsFound[requiredItem]
- if itemInfo and itemInfo.count > 0 then
- inputChest.pushItems(peripheral.getName(outputAltar), itemInfo.slot, 1)
- print("Transferred one " .. requiredItem .. " to the altar")
- end
- end
- end
- -- Main function
- local function main()
- local itemsFound = checkForRequiredItems()
- if not itemsFound then
- print("Aborting: Not all required items are present in the chest.")
- return
- end
- transferItems(itemsFound)
- print("All required items have been transferred to the altar.")
- end
- -- Run the main function
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement