SHARE
TWEET

Farm Builder

Oeed Jul 23rd, 2016 (edited) 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. DIRT = "minecraft:dirt"
  2. COBBLE = "minecraft:cobblestone"
  3. GLOWSTONE = "minecraft:glowstone"
  4.  
  5. local function place(block, direction)
  6.     local currentDetail = turtle.getItemDetail()
  7.     if not currentDetail or currentDetail.name ~= block then
  8.         while true do
  9.             local didFind = false
  10.             for i = 1, 16 do
  11.                 local nextDetail = turtle.getItemDetail(i)
  12.                 if nextDetail and nextDetail.name == block then
  13.                     didFind = true
  14.                     turtle.select(i)
  15.                     break
  16.                 end
  17.             end
  18.             if didFind then
  19.                 break
  20.             else
  21.                 print("Need more " .. block)
  22.                 print("Press any key...")
  23.                 os.pullEvent("key")
  24.             end
  25.         end
  26.     end
  27.     turtle.placeDown()
  28. end
  29.  
  30. local doPlace = function(isWater, z)
  31.     place(isWater and (z % 7 == 4 and GLOWSTONE or COBBLE) or DIRT)
  32. end
  33. local X_LIMIT, Y_LIMIT, Z_LIMIT = 14, 12, 33
  34. for y = 1, Y_LIMIT do
  35.     for x = 1, X_LIMIT do
  36.         local isWater = x == 4 or x == 11
  37.         if isWater then
  38.             turtle.down()
  39.         end
  40.         for z = 1, Z_LIMIT do
  41.             doPlace(isWater, z)
  42.             turtle.forward()
  43.         end
  44.         if x ~= X_LIMIT then
  45.             local turn = (x % 2 ~= y % 2) and turtle.turnLeft or turtle.turnRight
  46.             turn()
  47.             doPlace(isWater, 1)
  48.             turtle.forward()
  49.             turn()
  50.             if isWater then
  51.                 turtle.up()
  52.             end
  53.         else
  54.             if isWater then
  55.                 turtle.up()
  56.             end
  57.             turtle.turnLeft()
  58.             turtle.turnLeft()
  59.             place(isWater and COBBLE or DIRT)
  60.             turtle.up()
  61.             turtle.up()
  62.             turtle.up()
  63.         end
  64.     end
  65. 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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top