CmdDebugs

trainLanternBuilder

Apr 18th, 2021 (edited)
290
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. lantern_chest = 15
  2. fence_chest = 16
  3. oak_chest = 14
  4. offset = 13
  5.  
  6. chunk_loaders = 13
  7.  
  8. start_x, start_y, start_z = gps.locate()
  9.  
  10. function dig_down()
  11.     local success, data
  12.     success, data = turtle.inspectDown()
  13.     if success then
  14.         if (data.name == "minecraft:kelp") or (data.name == "environmental:cattail") or (data.name == "minecraft:grass") or (data.name == "minecraft:vine") or (data.name == "minecraft:oak_leaves") then
  15.             turtle.digDown()
  16.         end
  17.         if data.tags ~= nil then
  18.             for n,v in pairs(data.tags) do
  19.                 if (n == "minecraft:leaves") then
  20.                     turtle.digDown()
  21.                 end
  22.             end
  23.         end
  24.     end
  25. end
  26.  
  27. function refill_inventory()
  28.     turtle.select(oak_chest-offset)
  29.     if turtle.getItemCount() <= 16 then
  30.         turtle.select(oak_chest)
  31.         turtle.placeUp()
  32.         turtle.select(oak_chest-offset)
  33.         needed = turtle.getItemSpace()
  34.         turtle.suckUp(needed)
  35.         turtle.select(oak_chest)
  36.         turtle.digUp()
  37.     end
  38.  
  39.     turtle.select(lantern_chest-offset)
  40.     if turtle.getItemCount() <= 16 then
  41.         turtle.select(lantern_chest)
  42.         turtle.placeUp()
  43.         turtle.select(lantern_chest-offset)
  44.         needed = turtle.getItemSpace()
  45.         turtle.suckUp(needed)
  46.         turtle.select(lantern_chest)
  47.         turtle.digUp()
  48.     end
  49.  
  50.     turtle.select(fence_chest-offset)
  51.     if turtle.getItemCount() <= 16 then
  52.         turtle.select(fence_chest)
  53.         turtle.placeUp()
  54.         turtle.select(fence_chest-offset)
  55.         needed = turtle.getItemSpace()
  56.         turtle.suckUp(needed)
  57.         turtle.select(fence_chest)
  58.         turtle.digUp()
  59.     end
  60. end
  61.  
  62. function dig_detect()
  63.     local success, data
  64.     local status = false
  65.     status = turtle.detect()
  66.     if status then
  67.         success, data = turtle.inspect()
  68.         if (data.name == "minecraft:grass") or (data.name == "minecraft:vine") or (data.name == "minecraft:oak_leaves") then
  69.             turtle.dig()
  70.             status = false
  71.         end
  72.  
  73.         if data.tags ~= nil then
  74.             for n,v in pairs(data.tags) do
  75.                 if (n == "minecraft:leaves") then
  76.                     turtle.dig()
  77.                 end
  78.             end
  79.         end
  80.  
  81.     end
  82.  
  83.     return status
  84. end
  85.  
  86. function create_light()
  87.     turtle.turnRight()
  88.     if dig_detect() == false then
  89.         turtle.forward()
  90.         dig_down()
  91.         turtle.select(oak_chest-offset)
  92.         turtle.placeDown()
  93.         turtle.back()
  94.     end
  95.     turtle.select(fence_chest-offset)
  96.     turtle.place()
  97.  
  98.     turtle.up()
  99.     if dig_detect() == false then
  100.         turtle.select(fence_chest-offset)
  101.         turtle.place()
  102.     end
  103.  
  104.     turtle.up()
  105.     if dig_detect() == false then
  106.         turtle.select(fence_chest-offset)
  107.         turtle.place()
  108.     end
  109.  
  110.     if turtle.detectUp() then
  111.         turtle.down()
  112.         turtle.select(lantern_chest-offset)
  113.         turtle.placeUp()
  114.         turtle.down()
  115.     else
  116.         turtle.up()
  117.         if dig_detect() == false then
  118.             turtle.select(fence_chest-offset)
  119.             turtle.place()
  120.             turtle.down()
  121.             turtle.placeUp()
  122.             turtle.down()
  123.             turtle.select(lantern_chest-offset)
  124.             turtle.placeUp()
  125.             turtle.down()
  126.         else
  127.             turtle.select(fence_chest-offset)
  128.             turtle.down()
  129.             turtle.placeUp()
  130.             turtle.down()
  131.             turtle.select(lantern_chest-offset)
  132.             turtle.placeUp()
  133.             turtle.down()
  134.         end
  135.     end
  136.     turtle.turnLeft()
  137.  
  138.     x, y, z = gps.locate()
  139.     for i = 1, (y-start_y) do
  140.         print("Down")
  141.         turtle.down()
  142.     end
  143.  
  144. end
  145.  
  146. while true do
  147.     turtle.turnRight()
  148.     turtle.turnRight()
  149.     turtle.select(chunk_loaders)
  150.     turtle.place()
  151.     turtle.turnLeft()
  152.     turtle.turnLeft()
  153.     turtle.dig()
  154.  
  155.     refill_inventory()
  156.     create_light()
  157.     for i = 1, 11 do
  158.         turtle.forward()
  159.     end
  160.  
  161.     refill_inventory()
  162.     create_light()
  163.     for i = 1, 11 do
  164.         turtle.forward()
  165.     end
  166.  
  167.     refill_inventory()
  168.     create_light()
  169.     for i = 1, 11 do
  170.         turtle.forward()
  171.     end
  172.  
  173.     refill_inventory()
  174.     create_light()
  175.     for i = 1, 11 do
  176.         turtle.forward()
  177.     end
  178.  
  179.     turtle.select(chunk_loaders)
  180.     turtle.place()
  181.  
  182.     turtle.turnRight()
  183.     turtle.turnRight()
  184.     for i = 1, 44 do
  185.         turtle.forward()
  186.     end
  187.     turtle.select(chunk_loaders)
  188.     turtle.dig()
  189.    
  190.     turtle.turnLeft()
  191.     turtle.turnLeft()
  192.     for i = 1, 44 do
  193.         turtle.forward()
  194.     end
  195.    
  196. end
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×