Advertisement
Guest User

startup.lua

a guest
Apr 8th, 2020
631
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.48 KB | None | 0 0
  1. me = peripheral.wrap("back")
  2. mon = peripheral.wrap("top")
  3. local mxcw = 20
  4.  
  5.  
  6.  
  7. bottle = {}
  8. bottle["clear"] = {}
  9. bottle["clear"].amout = 0
  10. bottle["clear"].name = "toughasnails:purified_water_bottle"
  11.  
  12. bottle["empty"] = {}
  13. bottle["empty"].amout = 0
  14. bottle["empty"].name = "minecraft:glass_bottle"
  15.  
  16. bottle["water"] = {}
  17. bottle["water"].amout = 0
  18. bottle["water"].name = "minecraft:potion"
  19.  
  20. while true do
  21.     items = me.listItems()
  22.     for i, item in ipairs(items) do
  23.         if string.match(item.name, bottle["clear"].name) then
  24.             bottle["clear"].amout = item.amount
  25.         end
  26.         if string.match(item.name, bottle["water"].name) then
  27.             bottle["water"].amout = item.amount
  28.         end
  29.         if string.match(item.name, bottle["empty"].name) then
  30.             bottle["empty"].amout = item.amount
  31.         end
  32.     end
  33.    
  34.     print("Water: " .. bottle["water"].amout)
  35.     print("Clear: " .. bottle["clear"].amout)
  36.     print("Emtpy: " .. bottle["empty"].amout)
  37.    
  38.     if bottle["clear"].amout < mxcw then
  39.         local cwnd = mxcw - bottle["clear"].amout
  40.         if bottle["water"].amout > 0 then
  41.             x = me.export(bottle["water"].name ,0 ,cwnd ,"south")
  42.             print(x .. " water bottle exported from ME for clear")
  43.         elseif bottle["empty"].amout > 0 then
  44.             x = me.export(bottle["empty"].name,0,cwnd,"north")
  45.             print(x .."empty bottle exported from ME for refill and clear")
  46.         end
  47.     end
  48.     sleep(1)
  49. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement