Advertisement
jamemcdougal

Emerald Farm Controller

Dec 17th, 2014
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.15 KB | None | 0 0
  1.    
  2.  
  3.     ---Simple little program to automate my Minecraft emerald farm.
  4.     ---
  5.     ---Basic idea: I have an infinite villager breeder feeding into a
  6.     ---smeltery (yes, I'm a bad, bad man). This script is for the computer
  7.     ---to monitor the smeltery and trigger the drain whenever there's more than
  8.     ---one emerald in there. More than one so that the smeltery doesn't end up
  9.     ---empty and stop killing villagers.
  10.      
  11.     function alarm()
  12.             allGood=false
  13.             redstone.setOutput("bottom",true)
  14.             while not allGood do
  15.                     info=smelt.getInfo()
  16.                     allGood= (info.id==27)
  17.             end
  18.             redstone.setOutput("bottom",false)
  19.     end
  20.      
  21.     smelt=peripheral.wrap("right")
  22.      
  23.     alarm()
  24.      
  25.     while true do
  26.             info=smelt.getInfo()
  27.      print(info.id)
  28.             if not (info.id==27) then
  29.                     alarm()
  30.             elseif info.amount > 640 then
  31.                     redstone.setOutput("back",true)
  32.                     sleep(1)
  33.                     redstone.setOutput("back",false)
  34.             end
  35.             sleep(30)
  36.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement