Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- chests = {
- "quark:oak_chest",
- "charm:oak_chest",
- }
- fuel = {
- "minecraft:coal_block",
- "actuallyadditions:block_misc",
- "quark:charcoal_block",
- }
- wood = {
- "byg:fir_log"
- }
- furnaceCount = 5
- checkedSlots = 1
- function getFuel()
- isBlock, data = turtle.inspectDown()
- if (data.name == "charm:oak_chest") then
- fuelSlot = getFuelIndex()
- if fuelSlot ~= nil then
- turtle.select(fuelSlot)
- local coalBlocks = turtle.getItemCount()
- if coalBlocks <= 30 then
- turtle.suckDown(20)
- end
- elseif fuelSlot == nil then
- turtle.suckDown(30)
- end
- refuel()
- end
- end
- function getFuelIndex()
- for slotNum = 1, 16, 1 do
- local Item = turtle.getItemDetail(slotNum)
- if(Item ~=nil) then
- for fuelIndex =1, #fuel, 1 do
- if(Item.name == fuel[fuelIndex]) then
- return slotNum
- end
- end
- end
- end
- end
- function refuel()
- if(turtle.getFuelLevel() < 400) then
- local Index = getFuelIndex()
- if(Index ~= nil) then
- turtle.select(Index)
- turtle.refuel(2)
- end
- end
- end
- function getWood()
- turtle.select(1)
- local currentWood = getWoodCount()
- while currentWood < furnaceCount * 64 + 30 do
- local currentWood2 = currentWood
- turtle.suckDown()
- currentWood = getWoodCount()
- if currentWood2 == currentWood then
- sleep(100)
- end
- end
- end
- function getWoodIndex()
- for slotNum = 1, 16, 1 do
- local item = turtle.getItemDetail(slotNum)
- if(item ~= nil) then
- for woodIndex = 1, #wood, 1 do
- if(item.name == wood[woodIndex]) then
- return slotNum
- end
- end
- end
- end
- end
- function getWoodCount()
- woodCount = 0
- for slotNum = 1,16,1 do
- local whatsHere = turtle.getItemDetail(slotNum)
- if(whatsHere ~= nil) then
- if (whatsHere.name == "byg:fir_log") then
- turtle.select(slotNum)
- woodCount = woodCount + turtle.getItemCount()
- print("Current wood Count A-",woodCount)
- end
- end
- end
- print("Current wood Count B-",woodCount)
- return woodCount
- end
- function depositWood()
- for i = 1, furnaceCount, 1 do
- turtle.select(getWoodIndex())
- if turtle.getItemCount() < 64 then
- local amountDropped = turtle.getItemCount()
- turtle.dropDown(64)
- print("dropping -",amountDropped)
- turtle.select(getWoodIndex())
- turtle.dropDown(64 - amountDropped)
- print("dropping -",amountDropped)
- elseif turtle.getItemCount() == 64 then
- local amountDropped = turtle.getItemCount()
- turtle.dropDown(64)
- print("dropping -",amountDropped)
- end
- turtle.forward()
- end
- end
- function goHome()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.forward()
- atStart = false
- while atStart == false do
- local isBlock, data= turtle.inspectDown()
- if(data.name == "minecraft:furnace" ) then
- turtle.forward()
- elseif (data.name == "byg:fir_fence") then
- turtle.turnLeft()
- for i = 1, 5, 1 do
- turtle.forward()
- end
- elseif (data.name == "charm:oak_chest") then
- turtle.turnLeft()
- turtle.turnLeft()
- atStart = true
- end
- end
- end
- function goToWork()
- while turtle.detect() == false do
- turtle.forward()
- end
- turtle.turnRight()
- turtle.forward()
- end
- function transfer()
- getWood()
- goToWork()
- depositWood()
- getFuel()
- goHome()
- sleep(600)
- end
- while true do
- transfer()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement