Advertisement
karelvysinka

Turtle mining up down 2017 1

Aug 14th, 2017
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.67 KB | None | 0 0
  1. while true do
  2.  
  3. -- cyklus pro kopani 64x dolu
  4. -- turtla bude kopat dolů a posílat itemy do EnderChest
  5.  
  6. -- před startem je třeba provést ošetření/kontrolu, zda turtla nemá nad sebou Ender Chest, pokud ano, vcucni ji a dej do slotu 3
  7. -- kontrola je nutná kvůli odhlášení, či restartu serveru
  8.  
  9. turtle.select(3)   
  10. local success, data = turtle.inspectUp()
  11.  
  12. if success then
  13.     print("Block name: ", data.name)
  14.     dataEnder = data.name
  15.     print("Block metadata: ", data.metadata)
  16.     if dataEnder == "EnderStorage:enderChest" then
  17.         print("Nalezena Ender Chest")
  18.         turtle.digUp()
  19.     end
  20. end
  21.  
  22. --provedeme prvotni refuel, aby Turtla mohla dělat posun
  23. turtle.select(1)
  24. turtle.refuel()
  25. print("Proveden refuel...")
  26.  
  27. for a=1,64,1 do
  28.     turtle.select(1)
  29.     turtle.digDown()
  30.     turtle.select(2)
  31.     turtle.dig()
  32.     turtle.down()
  33.  
  34.     --provedeme kontrolu, zda neni natezen Coal v sl. 1,2
  35.     --pokud je natezen Coal, proved Refuel
  36.     local data1 = turtle.getItemDetail()
  37.  
  38.     if data1 then
  39.         print("Item name: ", data1.name)
  40.         dataX1 = data1.name
  41.         if dataX1 == "minecraft:coal" then
  42.             print("Nalezen coal. Provedu refuel.")
  43.             turtle.refuel()
  44.         end
  45.         print("Item damage value: ", data1.damage)
  46.         print("Item count: ", data1.count)
  47.     end
  48.  
  49.     local data2 = turtle.getItemDetail()
  50.     turtle.select(2)
  51.     if data2 then
  52.         print("Item name: ", data2.name)
  53.         dataX2 = data2.name
  54.         if dataX2 == "minecraft:coal" then
  55.             print("Nalezen coal. Provedu refuel.")
  56.             turtle.refuel()
  57.         end
  58.         print("Item damage value: ", data2.damage)
  59.         print("Item count: ", data2.count)
  60.     end
  61.     turtle.select(3)
  62.     -- Enderchest musi byt umistena ve slotu 3
  63.     --poloz Ender Chest a Slot 1,2 vyprazdni do Ender Chest
  64.     turtle.placeUp()
  65.     turtle.select(1)
  66.     turtle.dropUp()
  67.     turtle.select(2)
  68.     turtle.dropUp()
  69.     --vrat Ender Chest do slotu 3
  70.     turtle.select(3)
  71.     turtle.digUp()
  72.     a=a+1
  73.     print(a)
  74.  
  75. end
  76. turtle.forward()
  77.  
  78. --vyjedeme pro jistotu o 5 výše kvuli bedrocku
  79. turtle.up()
  80. turtle.up()
  81. turtle.up()
  82. turtle.up()
  83. turtle.up()
  84.  
  85. --otocime Turtlu doprava a dig, a popojedeme dopredu,aby nejela nahoru naprazdno
  86. --turtle.turnRight()
  87. turtle.dig()
  88. turtle.forward()
  89. a=0
  90. print("Jedu nahoru")
  91.  
  92. -- cyklus pro vraceni
  93. for a=1,59,1 do
  94.     turtle.select(1)
  95.     turtle.digUp()
  96.     turtle.select(2)
  97.     turtle.dig()
  98.    
  99.     --provedeme kontrolu, zda neni natezen Coal v sl. 1,2
  100.     --pokud je natezen Coal, proved Refuel
  101.  
  102.     local data1b = turtle.getItemDetail()
  103.     turtle.select(1)
  104.     if data1b then
  105.         print("Item name: ", data1b.name)
  106.         dataX1b = data1b.name
  107.         if dataX1b == "minecraft:coal" then
  108.             print("Nalezen coal. Provedu refuel.")
  109.             turtle.refuel()
  110.         end
  111.         print("Item damage value: ", data1b.damage)
  112.         print("Item count: ", data1b.count)
  113.     end
  114.  
  115.     local data2b = turtle.getItemDetail()
  116.     turtle.select(2)
  117.     if data2b then
  118.         print("Item name: ", data2b.name)
  119.         dataX2b = data2b.name
  120.         if dataX2b == "minecraft:coal" then
  121.             print("Nalezen coal. Provedu refuel.")
  122.             turtle.refuel()
  123.         end
  124.         print("Item damage value: ", data2b.damage)
  125.         print("Item count: ", data2b.count)
  126.     end
  127.     turtle.select(3)
  128.     -- Enderchest musi byt umistena ve slotu 3
  129.     --poloz Ender Chest a Slot 1,2 vyprazdni do Ender Chest
  130.     turtle.placeUp()
  131.     turtle.select(1)
  132.     turtle.dropUp()
  133.     turtle.select(2)
  134.     turtle.dropUp()
  135.     --vrat Ender Chest do slotu 3
  136.     turtle.select(3)
  137.     turtle.digUp()
  138.     turtle.up()
  139.     a=a+1
  140.     print(a)
  141.  
  142. end
  143. --opakujeme tezbu v dalsim sloupci
  144. turtle.dig()
  145. turtle.forward()
  146. turtle.dig()
  147. turtle.forward()
  148. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement