From d5f3debf56a3b702074305a5c4b4331ac6b7ca74 Mon Sep 17 00:00:00 2001 From: Emerson Rosen-Jones Date: Fri, 1 Aug 2025 22:59:36 -0400 Subject: [PATCH] Program to manage an iron generator built using create and the create datapack Ultimate Factory --- irongen.lua | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 irongen.lua diff --git a/irongen.lua b/irongen.lua new file mode 100644 index 0000000..c20a8ee --- /dev/null +++ b/irongen.lua @@ -0,0 +1,34 @@ +-- Program for managing an iron generator in create with the create: ultimate +-- factory datapack + +local store = peripheral.wrap("create:item_vault_0") +local basins = { peripheral.find("create:basin") } +local output = store +local BASIN_OUT_SLOT = 10 +local IRON_NUGGET = "minecraft:iron_nugget" +local GRAVEL = "minecraft:gravel" + +function find_item (inv, item_name) + for i, v in pairs(inv.list()) do + if v.name == item_name then + return i + end + end +end + +while true do + for _, b in ipairs(basins) do + local iron_slot = find_item(store, IRON_NUGGET) + local gravel_slot = find_item(store, GRAVEL) + local basin_name = peripheral.getName(b) + if gravel_slot ~= nil then + store.pushItems(basin_name, gravel_slot) + end + if iron_slot ~= nil then + store.pushItems(basin_name, iron_slot) + else + sleep(1) + end + output.pullItems(basin_name, BASIN_OUT_SLOT) + end +end