Advertisement
Deltric

Quarry

Nov 26th, 2020 (edited)
884
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.07 KB | None | 0 0
  1. function checkDirection(direction)
  2.     if direction == true then
  3.         turtle.turnRight()
  4.     else
  5.         turtle.turnLeft()
  6.     end
  7. end
  8.  
  9.    
  10. quarryDimensions = 16
  11. local SLOT_COUNT = 16
  12.  
  13. DROPPED_ITEMS = {
  14.     "minecraft:stone",
  15.     "minecraft:dirt",
  16.     "minecraft:cobblestone",
  17.     "minecraft:sand",
  18.     "minecraft:gravel",
  19.     "minecraft:redstone",
  20.     "minecraft:flint",
  21.     "railcraft:ore_metal",
  22.     "extrautils2:ingredients",
  23.     "minecraft:dye",
  24.     "thaumcraft:nugget",
  25.     "thaumcraft:crystal_essence",
  26.     "thermalfoundation:material",
  27.     "projectred-core:resource_item",
  28.     "thaumcraft:ore_cinnabar",
  29.     "deepresonance:resonating_ore",
  30.     "forestry:apatite",
  31.     "quark:limestone"
  32. }
  33. function dropItems()
  34.     print("Purging Inventory...")
  35.     for slot = 1, SLOT_COUNT, 1 do
  36.         local item = turtle.getItemDetail(slot)
  37.         if(item ~= nil) then
  38.             for filterIndex = 1, #DROPPED_ITEMS, 1 do
  39.                 if(item["name"] == DROPPED_ITEMS[filterIndex]) then
  40.                     print("Dropping - " .. item["name"])
  41.                     turtle.select(slot)
  42.                     turtle.dropDown()
  43.                 end
  44.             end
  45.         end
  46.     end
  47. end
  48.  
  49. direction = true
  50. while (5 > 1) do
  51.     a = 0
  52.     repeat
  53.         i = 0
  54.         repeat
  55.             turtle.dig()
  56.             turtle.forward()
  57.             i = i + 1
  58.         until (i > quarryDimensions-1)
  59.         if a < quarryDimensions then
  60.             checkDirection(direction)
  61.             turtle.dig()
  62.             turtle.forward()
  63.             checkDirection(direction)
  64.             if direction == true then
  65.                 direction = false
  66.             else
  67.                 direction = true
  68.             end
  69.         else
  70.             print("Stopped")
  71.         end
  72.         a = a + 1
  73.     until (a > quarryDimensions)
  74.     turtle.turnRight()
  75.     j = 0
  76.     repeat
  77.         turtle.forward()
  78.         j = j + 1
  79.         print(j)
  80.     until (j > quarryDimensions-1)
  81.     turtle.turnRight()
  82.     turtle.digDown()
  83.     turtle.down()
  84.     direction = true
  85.     dropItems()
  86.  
  87. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement