Program to manage an iron generator built using create and the create datapack Ultimate Factory
This commit is contained in:
parent
2cf0dc58d9
commit
d5f3debf56
1 changed files with 34 additions and 0 deletions
34
irongen.lua
Normal file
34
irongen.lua
Normal file
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue