Advertisement
Sir_Popsilots

Lava/water for create mod washing and heating

Jun 4th, 2022 (edited)
1,072
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.21 KB | None | 0 0
  1. local monitor = peripheral.wrap("monitor_0")
  2.  
  3. local function WhatsOut()
  4.     local waterbucket = turtle.getItemDetail(6)
  5.     local lavabucket = turtle.getItemDetail(7)    
  6.     if lavabucket.name == "minecraft:lava_bucket" and waterbucket.name == "minecraft:water_bucket" then
  7.         return "None"
  8.     elseif lavabucket.name == "minecraft:lava_bucket" then
  9.         return "Water"
  10.     elseif waterbucket.name == "minecraft:water_bucket" then
  11.         return "Lava"
  12.     end
  13.     return nil
  14. end
  15.  
  16. local outnow = WhatsOut()
  17.  
  18. local function printHEAT()
  19.     monitor.setCursorPos(1,1)
  20.     monitor.setTextColor(colors.red)
  21.     monitor.write("[HEAT] ")
  22. end
  23.  
  24. local function printWASH()
  25.     monitor.setCursorPos(1,2)
  26.     monitor.setTextColor(colors.lightBlue)
  27.     monitor.write("[WASH] ")
  28. end
  29.  
  30. local function Select(WaterOrLavaOrNone)
  31.     print("select",WaterOrLavaOrNone)
  32.     if WaterOrLavaOrNone == "None" then
  33.         monitor.setBackgroundColor(colors.black)
  34.         printHEAT()
  35.         printWASH()
  36.     elseif WaterOrLavaOrNone == "Lava" then
  37.         monitor.setBackgroundColor(colors.lightGray)
  38.         printHEAT()
  39.         monitor.setBackgroundColor(colors.black)
  40.         printWASH()
  41.     elseif WaterOrLavaOrNone == "Water" then
  42.         monitor.setBackgroundColor(colors.black)
  43.         printHEAT()
  44.         monitor.setBackgroundColor(colors.lightGray)
  45.         printWASH()
  46.     end
  47. end
  48.  
  49. local function PutOrRemove(WaterOrLava)
  50.     if WaterOrLava == "Lava" then
  51.         if outnow == "Water" then
  52.             turtle.select(6)
  53.             turtle.place()
  54.         end
  55.         turtle.select(7)
  56.         turtle.place()
  57.     elseif WaterOrLava == "Water" then
  58.         if outnow == "Lava" then
  59.             turtle.select(7)
  60.             turtle.place()
  61.         end
  62.         turtle.select(6)
  63.         turtle.place()
  64.     end
  65. end
  66.  
  67.  
  68. local function decipherPress(y)
  69.     if y == 1 then
  70.         return "Lava"
  71.     elseif y == 2 then
  72.         return "Water"
  73.     end
  74. end
  75.  
  76. while true do
  77.     Select(outnow)
  78.     sleep(0.3)
  79.     local event, side, x, y = os.pullEvent("monitor_touch")
  80.     local whatwaspressed = decipherPress(y)
  81.     PutOrRemove(whatwaspressed)
  82.     outnow = WhatsOut()
  83.     print("its ",outnow," Out there")
  84. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement