Epuuc

Minecraft CC Place Plane

Nov 21st, 2020 (edited)
944
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. print("How far do you want me to build?")
  2. local distance = tonumber(read())
  3. print("How wide do you want me to build?")
  4. local width = tonumber(read())
  5. local blocksleft = width*distance
  6.  
  7. term.clear()
  8. term.setCursorPos(0,0)
  9. print("Are you sure? Press any key to continue.")
  10. print("Total Blocks To Place: "..blocksleft)
  11. local blocksininv = 0
  12. for i=1,16 do
  13.     blocksininv = blocksininv + turtle.getItemCount(i)
  14. end
  15. print("Blocks in Inventory: "..blocksininv)
  16. if blocksininv < blocksleft then
  17.     local blocksshort = blocksleft-blocksininv
  18.     print("Blocks Short: "..blocksshort)
  19. end
  20. local projcomp = string.format("%0.1f",blocksininv/blocksleft)
  21. print("Projected Completion: "..projcomp.."%")
  22.  
  23. os.pullEvent("key")
  24.  
  25. local function placeDown()
  26.     local notified = false
  27.     while true do
  28.         if turtle.getItemCount() == 0 then
  29.             for itemslot=1,15 do
  30.                 turtle.select(itemslot+1)
  31.                 if turtle.getItemCount() > 0 then
  32.                     turtle.transferTo(itemslot)
  33.                 end
  34.             end
  35.         end
  36.         turtle.select(1)
  37.         if turtle.getItemCount() > 0 then
  38.             break
  39.         else
  40.             if not notified then
  41.                 rednet.send(411,{
  42.                     MsgType = "Notification",
  43.                     Title = "Out of Blocks.",
  44.                     Body = os.getComputerLabel().." is out of blocks."
  45.                 })
  46.                 notified = true
  47.                 print("Out of blocks")
  48.             end
  49.         end
  50.     end
  51.     turtle.placeDown()
  52.     blocksleft = blocksleft - 1
  53.     term.clear()
  54.     term.setCursorPos(0,0)
  55.     local totalbl = width*distance
  56.     print("Currently Placing Blocks")
  57.     print("Width: "..width)
  58.     print("Distance: "..distance)
  59.     print("Total Blocks: "..totalbl)
  60.     print("Blocks Left: "..blocksleft)
  61.     local completion = string.format("%0.1f",((totalbl-blocksleft)/totalbl)*100)
  62.     print("Completion: "..completion.."%")
  63.     local blocksininv = 0
  64.     for i=1,16 do
  65.         blocksininv = blocksininv + turtle.getItemCount(i)
  66.     end
  67.     print("Blocks in Inventory: "..blocksininv)
  68.     if blocksleft-blocksininv > 0 then
  69.         print("Blocks Needed: "..blocksleft-blocksininv)
  70.     end
  71. end
  72.  
  73.  
  74. turtle.forward()
  75. placeDown()
  76. turtle.turnRight()
  77. for d=1,distance do
  78.     for w=1,width-1 do
  79.         turtle.forward()
  80.         placeDown()
  81.     end
  82.     if d ~= distance then
  83.             if d % 2 ~= 0 then
  84.                 turtle.turnLeft()
  85.                 turtle.forward()
  86.         placeDown()
  87.                 turtle.turnLeft()
  88.             else
  89.                 turtle.turnRight()
  90.                 turtle.forward()
  91.         placeDown()
  92.                 turtle.turnRight()
  93.             end
  94.         end
  95. end
  96.  
RAW Paste Data