Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fuelChestLocation = 1
- fuelLocation = 2
- fenceChestLocation = 5
- fenceLocation = 6
- miningChestLocation = 9
- endQuarryLocation = 10
- trashLocation = 16
- function layFence(size)
- for i = 1,size do
- if (turtle.getFuelLevel() <= 1) then -- check if fuel is low
- getFuel() -- cal function load fuel
- end
- if (turtle.detectDown()) then -- Verify area below is clear
- turtle.select(trashLocation) -- select position for trash
- turtle.digDown() -- clear space for fence
- turtle.drop() -- clear trash
- end
- if (turtle.getItemCount(fenceLocation) <= 0) then -- check if fences are loaded
- getFences() -- call function to load fences
- end
- turtle.select(fenceLocation) -- select position of fences
- turtle.placeDown() -- place fence
- turtle.select(trashLocation)
- turtle.dig() -- clear space forward
- turtle.drop() -- clear trash
- turtle.forward() -- move forward
- end
- end
- function removeFence(size)
- for i = 1,size do
- if (turtle.getFuelLevel() <= 1) then -- check if fuel is low
- getFuel() -- cal function load fuel
- end
- if (turtle.getItemCount(fenceLocation) > 63) then
- turtle.select(miningChestLocation)
- turtle.placeUp() -- place ender chest
- turtle.select(fenceLocation) -- select position where fences are being placed
- turtle.dropUp(64) -- push stack of fences into above inventory
- turtle.select(miningChestLocation) -- select position where fence chest is to be stored
- turtle.digUp() -- grab fence chest
- end
- turtle.select(fenceLocation) -- select position of fences
- turtle.digDown() -- pickup fence
- turtle.forward() -- move forward
- end
- end
- function getFuel()
- if turtle.detectUp() then -- verify space above is clear
- turtle.select(trashLocation) -- select position for trash
- turtle.digUp() -- clear space for Ender chest
- turtle.drop() -- clear trash
- end
- turtle.select(fuelChestLocation) -- select position where Ender chest is located that contains fuel
- turtle.placeUp() -- place ender chest
- turtle.select(fuelLocation) -- select position where fuel is to be kept
- turtle.suckUp() -- grab a stack of fuel
- turtle.refuel(64) -- refuel
- turtle.select(fuelChestLocation) -- return to position for storing ender chest
- turtle.digUp() -- retrieve Ender chest
- end
- function getFences()
- if turtle.detectUp() then -- verify space above is clear
- turtle.select(trashLocation) -- select position for trash
- turtle.digUp() -- clear space for Ender chest
- turtle.drop() -- clear trash
- end
- turtle.select(fenceChestLocation) -- select position where Ender chest is located that contains fences
- turtle.placeUp() -- place Ender chest
- turtle.select(fenceLocation) -- select position where fences is to be kept
- turtle.suckUp() -- grab a stack of fences
- turtle.select(fenceChestLocation) -- return to position for storing ender chest
- turtle.digUp() -- retrieve Ender chest
- end
- print("What would you like to do? Make a selection:")
- print(" 1 - Place Ender Quarry")
- print(" 2 - Pickup Ender Quarry")
- write("Choice: ")
- local input = read()
- write("What size? ")
- local size = read()
- if (input == "1") then
- for i = 1,4 do
- layFence(size)
- turtle.turnLeft()
- end
- turtle.select(fenceLocation) -- select position where fences are being placed
- turtle.digDown()
- turtle.select(endQuarryLocation)
- turtle.placeDown()
- turtle.up()
- turtle.select(miningChestLocation)
- turtle.placeDown()
- turtle.select(fenceLocation)
- turtle.dropDown()
- elseif (input == "2") then
- turtle.select(miningChestLocation)
- turtle.digDown()
- turtle.down()
- turtle.select(endQuarryLocation)
- turtle.digDown()
- for i = 1,4 do
- removeFence(size)
- turtle.turnLeft()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment