pandorrama

NetherStar

Sep 19th, 2020 (edited)
952
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- TO INSTALL JUST EXECUTE: pastebin get GscK4883 netherstar.lua
  2.  
  3. local component = require("component")
  4. local robot = require("robot")
  5. local shell = require("shell")
  6. local sides = require("sides")
  7. local chests = component.inventory_controller
  8. local sandChestPlace = sides.bottom
  9. local scullChestPlace = sides.up
  10. local sandSlot = 1
  11. local skullSlot = 2
  12.  
  13.  
  14. local function getItems()
  15. --  for i=1,tonumber(chest.getInventorySize(sides.bottom)) do
  16. --    if chest.getStackInSlot(chestPlace, i) then
  17. --      if chest.getStackInSlot(chestPlace, i).label == "Soul Sand" then
  18. --        print("suck Soul Sand from chest")
  19. --        chest.suckFromSlot(chestPlace, i)
  20. --        sandSlot = i
  21. --      elseif chest.getStackInSlot(chestPlace, i).label == "Wither Skeleton Skull" then
  22. --        print("suck Wither Skelleton Skull from chest")
  23. --        chest.suckFromSlot(chestPlace, i)
  24. --        skullSlot = i
  25. --      end
  26. --    end
  27. --  end
  28.   if tonumber(chests.getSlotStackSize(sandChestPlace, 1)) >= 64 and tonumber(chests.getSlotStackSize(scullChestPlace, 1)) >= 48 then
  29.     robot.select(sandSlot)
  30.     chests.suckFromSlot(sandChestPlace, 1, 64)
  31.    
  32.     robot.select(skullSlot)
  33.     chests.suckFromSlot(scullChestPlace, 1, 48)
  34.     return true
  35.   else
  36.     return false
  37.   end
  38. end
  39.  
  40.  
  41. local function moveToBuild()
  42.   for i=1,3 do robot.back() end
  43.   robot.turnRight()
  44.   for i=1,2 do robot.forward() end
  45.   for i=1,2 do robot.down() end  
  46. end
  47.  
  48. local function buildWither()
  49.   robot.select(sandSlot)
  50.   robot.place()
  51.   robot.up()
  52.   robot.place()
  53.   robot.turnRight()
  54.   robot.forward()
  55.   robot.turnLeft()
  56.   robot.place()
  57.   robot.turnLeft()
  58.   for i=1,2 do robot.forward() end
  59.   robot.turnRight()
  60.   robot.place()
  61.   robot.up()
  62.   robot.select(skullSlot)
  63.   robot.place()
  64.   robot.turnRight()
  65.   for i=1,2 do robot.forward() end
  66.   robot.turnLeft()
  67.   robot.place()
  68.   robot.turnRight()
  69.   robot.back()
  70.   robot.turnLeft()
  71.   robot.place()
  72. end
  73.  
  74. local function moveToChest()
  75.   for i=1,2 do robot.back() end
  76.   robot.turnLeft()
  77.   for i=1,3 do robot.forward() end
  78. end
  79.  
  80.  
  81. -- RUNTIME STARTS HERE
  82.  
  83. while true do
  84.   if getItems() == true then
  85.     for j=1, 16 do
  86.       moveToBuild()
  87.       buildWither()
  88.       moveToChest()
  89.       os.sleep(15)
  90.     end
  91.   else
  92.     os.sleep(60)
  93.   end
  94. end
RAW Paste Data