Advertisement
Guest User

startup

a guest
Mar 25th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.64 KB | None | 0 0
  1. local m = peripheral.wrap "back"
  2.  
  3. function groundDistance(meta)
  4.     local blocks = m.scan()
  5.     for y = 0, -8, -1 do
  6.         local block = blocks[1 + (8 + (8 + y)*17 + 8*17^2)]
  7.        
  8.         if block.name ~= "minecraft:air" then
  9.             return -y
  10.         end
  11.     end
  12.    
  13.     return 8
  14. end
  15.  
  16. function normalFly(meta)
  17.     m.launch(meta.yaw, meta.pitch, 3)    
  18. end
  19.  
  20. while true do
  21.     local meta = m.getMetaOwner()
  22.  
  23.     if groundDistance(meta) < 8 and meta.motionY < -0.1 then
  24.         m.launch(0, 270, math.min(4, math.abs(meta.motionY)))
  25.     end
  26.            
  27.     if meta.isSneaking then
  28.         normalFly(meta)
  29.     end
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement