Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FuelLevel = turtle.getFuelLevel()
- FuelSlot = 1
- --Clear the terminal for start of execution
- term.clear()
- print("Starting 'build_waterwheel' Press any key to continue...")
- os.pullEvent("key")
- term.clear()
- --Check that fuel is at least the limit
- function fuelMaint(limit)
- print("Checking to see if fuel level is at least " .. limit)
- turtle.select(FuelSlot)
- print("Switching to the fuel slot...")
- if FuelLevel < limit then
- while( FuelLevel < limit ) do
- print("Current fuel level is " .. FuelLevel)
- print("Refueling with " .. turtle.getItemDetail().name)
- turtle.refuel(1)
- end
- print("Refueled to a fuel level of " .. FuelLevel)
- else
- print("Fuel Level check passed!")
- end
- print("Press any key to continue...")
- os.pullEvent("key")
- term.clear()
- end
- --select inventory slot based on item name and metadata
- function selectSpecific(itemName, metaData)
- --Begin search at slot 1
- print("Beginning search for " .. itemName .. " with metadata of " .. metaData .. " at inventory slot 1")
- turtle.select(1)
- for i=1,16,1 do
- if turtle.getItemCount(i) > 0 then
- print("Slot " .. i .. " contains " .. turtle.getItemDetail(i).name .. " with metadata of " .. turtle.getItemDetail(i).damage)
- if turtle.getItemDetail(i).name == itemName and turtle.getItemDetail(i).damage == metaData then
- print("Item was found!")
- turtle.select(i)
- return 1
- end
- else
- print("There was nothing in slot " .. i)
- end
- if i==16 then
- print(itemName .. " with metadata of " .. metaData .. " could not be found!")
- print("Press any key to end...")
- os.pullEvent("key")
- term.clear()
- return 0
- end
- end
- end
- --place block below
- function placeD(itemName, metaData)
- print("attempting to place " .. itemName .. " with metadata of " .. metaData .. "...")
- if selectSpecific(itemName,metaData) == 0 then
- print("Item could not be placed")
- else
- turtle.placeDown()
- print("Item was placed.")
- end
- end
- --[[Test calls--]]
- --fuelMaint(500)
- --selectSpecific("minecraft:planks", 2)
- --[[--]]
- placeD("minecraft:planks", 2)
- --End the program and clear the screen
- print("End of Program. Press any key to continue...")
- os.pullEvent("key")
- term.clear()
Add Comment
Please, Sign In to add comment