SHARE
TWEET

Untitled

bit_Shifted Mar 20th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local scanner = peripheral.wrap("right")
  2. local p_mc = "minecraft:"
  3. local scanned = scanner.scan()
  4.  
  5. function moveTo(x, y, z)
  6.     local currentPos = vector.new(gps.locate())
  7.     local blocksToMoveX = x - currentPos.x
  8.     local blocksToMoveY = y - currentPos.y
  9.     local blocksToMoveZ = z - currentPos.z
  10.  
  11.     if blocksToMoveY > 0 then
  12.         for i = 1,math.abs(blocksToMoveY) do
  13.             turtle.up()
  14.         end
  15.     elseif blocksToMoveY < 0 then
  16.         for i = 1,math.abs(blocksToMoveY) do
  17.             turtle.down()
  18.         end
  19.     end
  20.  
  21.     turtle.turnLeft()
  22.     if blocksToMoveX > 0 then
  23.         for i = 1,math.abs(blocksToMoveX) do
  24.             turtle.forward()
  25.         end
  26.     elseif blocksToMoveX < 0 then
  27.         for i = 1,math.abs(blocksToMoveX) do
  28.             turtle.back()
  29.         end
  30.     end
  31.  
  32.     turtle.turnRight()
  33.  
  34.     if blocksToMoveZ > 0 then
  35.         for i = 1,math.abs(blocksToMoveZ) do
  36.             turtle.forward()
  37.         end
  38.     elseif blocksToMoveZ < 0 then
  39.         for i = 1,math.abs(blocksToMoveZ) do
  40.             turtle.back()
  41.         end
  42.     end
  43. end
  44.  
  45. local currentPos = vector.new(gps.locate())
  46. moveTo(-148, 56, -356)
  47.  
  48. for _, b in pairs(scanned) do
  49.     if b.name == p_mc.."log" then
  50.         print(b.name.." found at: "..b.x.." "..b.y.." "..b.z)
  51.     end
  52. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top