Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Starting OrbCrafting Auto V1.0")
- local SLOT_SUCK = 1
- local SLOT_LIST = {
- ["minecraft:iron_ingot"] = 2,
- ["minecraft:gold_ingot"] = 3,
- ["minecraft:blaze_rod"] = 4,
- ["emendatusenigmatica:uranium_block"] = 5,
- ["minecraft:blue_ice"] = 6,
- ["powah:dielectric_casing"] = 7,
- ["minecraft:ender_eye"] = 8,
- ["powah:capacitor_basic_tiny"] = 9,
- ["minecraft:emerald_block"] = 10,
- }
- local RECIPE_LIST = {
- ["minecraft:iron_ingot"] = {
- {SLOT_LIST["minecraft:iron_ingot"], 1},
- {SLOT_LIST["minecraft:gold_ingot"], 1}
- },
- ["minecraft:gold_ingot"] = {
- {SLOT_LIST["minecraft:iron_ingot"], 1},
- {SLOT_LIST["minecraft:gold_ingot"], 1}
- },
- ["minecraft:blaze_rod"] = {
- {SLOT_LIST["minecraft:blaze_rod"], 1}
- },
- ["emendatusenigmatica:uranium_block"] = {
- {SLOT_LIST["emendatusenigmatica:uranium_block"], 1}
- },
- ["minecraft:blue_ice"] = {
- {SLOT_LIST["minecraft:blue_ice"], 2}
- },
- ["powah:dielectric_casing"] = {
- {SLOT_LIST["powah:dielectric_casing"], 1},
- {SLOT_LIST["minecraft:ender_eye"], 1},
- {SLOT_LIST["powah:capacitor_basic_tiny"], 1}
- },
- ["minecraft:ender_eye"] = {
- {SLOT_LIST["powah:dielectric_casing"], 1},
- {SLOT_LIST["minecraft:ender_eye"], 1},
- {SLOT_LIST["powah:capacitor_basic_tiny"], 1}
- },
- ["powah:capacitor_basic_tiny"] = {
- {SLOT_LIST["powah:dielectric_casing"], 1},
- {SLOT_LIST["minecraft:ender_eye"], 1},
- {SLOT_LIST["powah:capacitor_basic_tiny"], 1}
- },
- ["minecraft:emerald_block"] = {
- {SLOT_LIST["minecraft:emerald_block"], 1}
- }
- }
- local function delayfn(start, delay, name)
- if os.clock() - start >= delay then
- error("Timelatch " .. name .. " broken")
- return false
- end
- return true
- end
- --class that returns true for n seconds past when this is created
- local function timeLatch(n, name)
- latch = {}
- latch.eval = function() delayfn(latch.start, latch.delay, latch.name) end
- latch.start = os.clock()
- latch.delay = n
- latch.name = name or "latch"
- return latch
- end
- local function safeSuck()
- turtle.select(SLOT_SUCK)
- if turtle.suckUp() then
- if not turtle.transferTo(SLOT_LIST[turtle.getItemDetail().name]) then
- turtle.dropUp()
- end
- return true
- end
- return false
- end
- function idle()
- while not safeSuck() do
- sleep(0.1)
- end
- while safeSuck() do
- sleep(0.1)
- end
- end
- function scanRecipe()
- for i, v in pairs(SLOT_LIST) do
- turtle.select(v)
- if turtle.getItemCount() > 0 then
- return RECIPE_LIST[i]
- end
- end
- end
- function waitForRecipeCompletion()
- sleep(0.5)
- while rs.getInput("back") do
- sleep(0.5)
- end
- end
- function performRecipe(recipe)
- if recipe then
- while true do
- for i, v in pairs(recipe) do
- turtle.select(v[1])
- if turtle.getItemCount() == 0 then return end
- turtle.dropDown(v[2])
- end
- waitForRecipeCompletion()
- end
- end
- end
- while true do
- idle()
- recipe = scanRecipe()
- while recipe do
- performRecipe(recipe)
- recipe = scanRecipe()
- end
- end
Add Comment
Please, Sign In to add comment