Advertisement
ecco7777

CC Laser mining Turtle + Ore Scanner

Dec 14th, 2022 (edited)
907
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.89 KB | None | 0 0
  1. print("slot1 scanner or laser")
  2. print("slot2 vacuumulator")
  3. print("slot3 enderchest")
  4.  
  5. sc=peripheral.wrap("right")
  6.  
  7. function sEquip(module) --plethora:laser plethora:scanner
  8.     if module~=peripheral.getType("right") then
  9.         turtle.select(1)
  10.         turtle.equipRight()
  11.         sc=peripheral.wrap("right")
  12.     end
  13. end
  14.  
  15. filter="minecraft:coal_ore/0 minecraft:iron_ore/0 minecraft:gold_ore/0 minecraft:diamond_ore/0 minecraft:redstone_ore/0 minecraft:emerald_ore/0 minecraft:lapis_ore/0appliedenergistics2:quartz_ore/0 appliedenergistics2:charged_quartz_ore/0thermalfoundation:ore/0 thermalfoundation:ore/1 thermalfoundation:ore/2 thermalfoundation:ore/3 thermalfoundation:ore/4 thermalfoundation:ore/5 thermalfoundation:ore/6 thermalfoundation:ore/7 thermalfoundation:ore/8 thermalfoundation:ore_fluid/0 thermalfoundation:ore_fluid/1 thermalfoundation:ore_fluid/2 thermalfoundation:ore_fluid/3 thermalfoundation:ore_fluid/4 thermalfoundation:ore_fluid/5ic2:resource/1 ic2:resource/2 ic2:resource/3 ic2:resource/4 bigreactors:oreyelloriteprojectred-exploration:ore/6biomesoplenty:gem_ore/0 biomesoplenty:gem_ore/1 biomesoplenty:gem_ore/2 biomesoplenty:gem_ore/3 biomesoplenty:gem_ore/4 biomesoplenty:gem_ore/5 biomesoplenty:gem_ore/6 biomesoplenty:gem_ore/7 thaumcraft:ore_amber/0 thaumcraft:ore_quartz/0 thaumcraft:ore_cinnabar/0 "
  16.  
  17. function fingerprint(block)
  18.     return block.name.."/"..block.metadata
  19. end
  20.  
  21. function main()
  22.     while true do
  23.         --scan
  24.         sEquip("plethora:scanner")
  25.         blocks={}
  26.         scanned=sc.scan()
  27.         for ib=#scanned/2+0.5,#scanned do
  28.             if string.find(filter,fingerprint(scanned[ib])) then
  29.                 table.insert(blocks,scanned[ib])
  30.             end
  31.         end
  32.         if #blocks>0 then
  33.             sEquip("plethora:laser")
  34.             for il=1,#blocks do
  35.                 block=blocks[il]
  36.                 pitch = -math.atan2(block.y, math.sqrt(block.x * block.x + block.z * block.z))
  37.                 yaw = math.atan2(-block.x, block.z)
  38.                 sc.fire(math.random()*2+math.deg(yaw)-1,math.random()*2+math.deg(pitch)-1,5)
  39.             end
  40.         else
  41.             turtle.digUp()
  42.             turtle.up()
  43.             turtle.digUp()
  44.             turtle.up()
  45.             turtle.down()
  46.             turtle.select(2)
  47.             turtle.placeDown()
  48.             turtle.up()
  49.             turtle.select(3)
  50.             turtle.placeDown()
  51.             for idrop=2,16 do
  52.                 turtle.select(idrop)
  53.                 turtle.dropDown()
  54.             end
  55.             sleep(3)
  56.             turtle.select(3)
  57.             turtle.digDown()
  58.             turtle.select(2)
  59.             turtle.down()
  60.             turtle.digDown()
  61.             turtle.down()
  62.             for idig=1,8 do
  63.                 turtle.dig()
  64.                 turtle.digUp()
  65.                 turtle.forward()
  66.             end
  67.         end
  68.         sleep(0.5)
  69.     end
  70. end
  71.  
  72. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement