DYankee

Test 3

Dec 14th, 2020 (edited)
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.77 KB | None | 0 0
  1. local Slot_Count = 16
  2. local x = 50
  3. local z = 50
  4.  
  5. DROPPED_ITEMS = {
  6.     "minecraft:stone",
  7.     "minecraft:dirt",
  8.     "minecraft:cobblestone",
  9.     "minecraft:sand",
  10.     "minecraft:gravel",
  11.     "minecraft:flint",
  12.     "minecraft:dye",
  13.     "forestry:apatite"
  14. }
  15.  
  16. function Drop_Items()
  17.   print("Droping trash...")
  18.   for SlotNum = 1, Slot_Count, 1 do
  19.     local Item = turtle.getItemDetail(SlotNum)
  20.     if(Item ~= nil) then
  21.       for FilterIndex = 1, #DROPPED_ITEMS, 1 do
  22.         if(Item["name"] == DROPPED_ITEMS[FilterIndex]) then
  23.             print("Droppign - " .. Item["name"])
  24.             turtle.select(SlotNum)
  25.             turtle.dropDown()
  26.           end
  27.         end
  28.       end
  29.     end
  30.   end
  31.   -- drops unwanted items
  32.   function GetEnderIndex()
  33.   for SlotNum = 1, Slot_Count, 1 do
  34.     local Item = turtle.getItemDetail(SlotNum)
  35.     if(Item ~=nil) then
  36.       if(Item["name"] == "enderstorage:ender_storage") then
  37.         return SlotNum
  38.       end
  39.     end
  40.   end
  41. end
  42. -- finds slot with ender chest
  43. function manageInventory()
  44.   Drop_Items()
  45.   Index = GetEnderIndex()
  46.   if(Index ~= nil) then
  47.     turtle.select(Index)
  48.     turtle.digUp()
  49.     turtle.placeUp()
  50.   end
  51.   -- ender chest deployed
  52.   for SlotNum = 1, Slot_Count, 1 do
  53.     local Item = turtle.getItemDetail(SlotNum)
  54.     if(Item ~=nil) then
  55.       if(Item["name"] ~= "minecraft:coal_block" and Item["name"] ~= "actuallyadditions:block_misc") then
  56.         turtle.select(SlotNum)
  57.         turtle.dropUp()
  58.       end
  59.     end
  60.   end
  61.   -- Items are stored
  62.   turtle.digUp()
  63. end
  64. -- thorws out trash and stores items
  65. function GetFuelIndex()
  66.   for SlotNum = 1, Slot_Count, 1 do
  67.     local Item = turtle.getItemDetail(SlotNum)
  68.     if(Item ~=nil) then
  69.       if(Item["name"] == "minecraft:coal_block" or Item["name"] == "actuallyadditions:block_misc") then
  70.         return SlotNum
  71.       end
  72.     end
  73.   end
  74. end
  75. --Finds slot with fuel
  76. function Refuel()
  77.   if(turtle.getFuelLevel() < 400) then
  78.   Index = GetFuelIndex()
  79.     if(Index ~= nil) then
  80.     turtle.select(Index)
  81.     turtle.refuel(2)
  82.     end
  83.   end
  84. end
  85. -- Checks fuel lvl and refuels when necessary.
  86.  
  87. function Mine_Forward()
  88.   for var = 1, x, 1 do
  89.     turtle.dig()
  90.     turtle.forward()
  91.     turtle.digDown()
  92.     turtle.digUp()
  93.     end
  94. end
  95. -- mines a 1 wide by 3 tall tunnel
  96. function Next_Row_R()
  97.   Refuel()
  98.   turtle.turnRight()
  99.   turtle.dig()
  100.   turtle.forward()
  101.   turtle.digUp()
  102.   turtle.digDown()
  103.   turtle.turnRight()
  104. end
  105.  
  106. function Next_Row_L()
  107.   Refuel()
  108.   turtle.turnLeft()
  109.   turtle.dig()
  110.   turtle.forward()
  111.   turtle.digUp()
  112.   turtle.digDown()
  113.   turtle.turnLeft()
  114. end
  115.  
  116. function Quarry()
  117.   Refuel()
  118.   for var = 1, z/2, 1 do
  119.     manageInventory()
  120.     Mine_Forward()
  121.     Next_Row_L()
  122.     Mine_Forward()
  123.     Next_Row_R()
  124.   end
  125. end
  126. Quarry()
Add Comment
Please, Sign In to add comment