Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Work in Progress
- --TODO: Load Cookables in top
- --TODO: Extract Finished product, return to chest
- --TODO: Determine how many furnaces this little guy can manage and have him setup that many instead of just 1
- --A turtle furnace Management Program
- --by hornedcommando
- function input()
- while true do
- write("I need a furnace, and a chest to work properly, Ok?")
- break
- end
- end
- -- Function to search the inventory for an item from a table
- function searchInventory(items)
- print("Searching inventory for items")
- for slot = 1, 16 do
- turtle.select(slot)
- local slotDetail = turtle.getItemDetail()
- if slotDetail then
- for _, item in ipairs(items) do
- if slotDetail.name == item then
- print("Found " .. item .. " in slot " .. slot)
- return true, slot
- end
- end
- end
- end
- print("Could not find any items in inventory")
- return false
- end
- function setup()
- print("setting up")
- searchInventory("minecraft:furnace")
- turtle.place()
- turtle.turnRight()
- turtle.forward()
- turtle.turnLeft()
- searchInventory("minecraft:chest")
- turtle.place()
- turtle.up()
- turtle.forward()
- turtle.forward()
- turtle.down()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- -- Function to wait until items are put into a chest
- function waitForItems()
- print("Waiting for items...")
- local pulledSomething = false
- while not inventoryFull() do
- if turtle.suck() then
- pulledSomething = true
- else
- if pulledSomething then
- print("No more items in the chest")
- break
- end
- end
- sleep(1) -- Adjust the sleep duration as needed
- end
- end
- local fuels = {
- "minecraft:coal",
- "minecraft:charcoal",
- "minecraft:oak_planks",
- "minecraft:stick",
- "minecraft:wooden_pickaxe",
- "minecraft:wooden_shovel",
- "minecraft:wooden_axe",
- "minecraft:wooden_sword",
- "minecraft:oak_slab",
- "minecraft:oak_sapling",
- "minecraft:spruce_sapling",
- "minecraft:birch_sapling",
- "minecraft:jungle_sapling",
- "minecraft:acacia_sapling",
- "minecraft:dark_oak_sapling",
- "minecraft:bamboo",
- "minecraft:kelp",
- "minecraft:lava_bucket",
- "minecraft:blaze_rod",
- "minecraft:coal_block",
- "minecraft:dried_kelp_block",
- }
- function fuelFurnace()
- turtle.turnRight()
- turtle.forward()
- turtle.turnLeft()
- turtle.drop()
- end
- setup()
- waitForItems()
- searchInventory(fuels)
- fuelFurnace()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement