Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Program:
- -- startup
- -- Original Program by Direwolf20
- -- Modified by Kzorith
- -- Description:
- -- Controls the operation of the Uberminer
- -- Hardware Requirement:
- -- 1 Advanced Mining Turtle
- -- 1 Chest
- -- Initialization
- -- set this to whatever side the chest is on
- c = peripheral.wrap("front")
- -- loop forever doing the following
- while true do
- -- set a counter to indicate what slot in the chest we are looking at
- i = 2
- -- while the turtle is low on fuel
- while turtle.getFuelLevel() < 200 do
- -- look in a particular slot in the chest
- -- first time through it'll be the second slot
- -- if there is an item in that slot...
- if c.getStackInSlot(i) then
- -- pull it into the turtle
- -- "south" is the direction that the turtle is from the chest
- -- 'i' is the slot in the chest to take from
- -- '64' is the maximum number to take
- -- '16' is the slot in the turtle to put the items
- c.pushItem("south",i,64,16)
- -- set the turtle to look at slot 16
- turtle.select(16)
- -- try to use what's in that slot to refuel
- turtle.refuel()
- -- if there are still items in the slot, it wasn't suitable for refueling
- if turtle.getItemCount(16) > 0 then
- -- put the item back where you got it
- -- "south" is the direction the turtle is from the chest
- -- '16' is the slot on the turtle to take from
- -- '64' is the maximum amount to take
- -- 'i' is the slot in the chest in which to put the items
- c.pullItem("south",16,64,i)
- end -- if getItemCount
- -- set the turtle to look at slot 1
- turtle.select(1)
- end -- if getStackInSlot
- -- move to the next slot in the chest
- i = i + 1
- -- if we've moved beyond the last slot...
- if i > 27 then
- -- print that the turtle can't refuel
- print("No fuel available for refueling.")
- -- exit the while getFuelLevel loop
- break
- end -- if i > 27
- end -- while getFuelLevel
- -- print what we are doing
- print("Checking for item in chest")
- -- if there is an item in slot 1
- -- note we don't care about any other slot other than slot 1
- if c.getStackInSlot(1) then
- -- print what we are doing
- print(" Item Present: Mining")
- -- execute the mine program
- shell.run("mine2")
- -- otherwise
- else
- -- print what we are doing
- print(" Item Missing: Waiting")
- -- wait 5 seconds
- sleep(5)
- end -- if getStackInSlot
- end -- while true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement