Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Mana Generator Program V2 by MinoCraft72
- -- Coded & Tested with:
- -- MineCraft 1.8.9 - MineCraft 1.18.2
- -- ComputerCraft 1.79 - CC-Tweaked 1.100.5
- -- Botania Unofficial r1.8-299 - Botania 1.18.2-431
- -- Config:
- rsOutput = "right" -- dispenser activation
- compSide = "left" -- comparator side
- detect_m = "top" -- not used
- genType = "entro" -- Can use "endo" or "entro"
- flower = 4 -- numbers of flowers
- waitT = 40 -- waiting time between 2 drop (20s -> Endo ; 40s -> Entro)
- rsRun = 12 -- analogique redstone signal to generate mana
- pulseT = 2 -- drop timer setting (1s -> Endo ; 2s -> Entro)
- useMon = true -- set to true if using monitor
- monSide = "monitor_0" -- monitor side
- -- Prog:
- function comparator()
- rsIn = rs.getAnalogInput(compSide)
- if rsIn < rsRun then
- genMana = true
- elseif rsIn == 15 then
- genMana = false
- end
- print(genMana)
- end
- function dropItem()
- if genMana then
- term.setCursorPos(1,5)
- for n = 1,flower do
- sleep(0)
- term.setTextColor(colors.orange)
- term.clearLine()
- print("Item dropped for Flower #"..n)
- rs.setOutput(rsOutput,true)
- sleep(1)
- rs.setOutput(rsOutput,false)
- sleep(pulseT)
- end
- sleep(3)
- end
- end
- function dropTimer()
- for t = waitT, 0, -1 do
- term.setCursorPos(1,4)
- term.clearLine()
- term.setTextColor(colors.white)
- write("Waiting Time: ")
- term.setTextColor(colors.orange)
- print(t)
- monitor()
- sleep(1)
- end
- end
- function entropinum()
- if genMana then
- for f = 1,flower do
- rs.setOutput(rsOutput,true)
- sleep(1)
- rs.setOutput(rsOutput,false)
- sleep(pulseT)
- print(f)
- end
- sleep(10)
- end
- end
- function screen()
- term.clear()
- term.setTextColor(colors.white)
- write("Mana Pool: ")
- percent = math.ceil((100 * rs.getAnalogInput(compSide))/ 15)
- term.setTextColor(colors.orange)
- write(percent.."% - ("..rs.getAnalogInput(compSide)..")")
- for l = 5, (5+flower) do
- term.setCursorPos(1,l)
- term.clearLine()
- end
- term.setTextColor(colors.white)
- end
- function monitor()
- if useMon then
- mon = peripheral.wrap(monSide)
- xMax,yMax = mon.getSize()
- mon.clear()
- term.setCursorPos(1,1)
- mon.setCursorPos(1,1)
- mon.write("Mana")
- --print(xMax..","..yMax)
- percent = math.ceil((100 * rs.getAnalogInput(compSide))/ 15)
- lineMax = yMax - rs.getAnalogInput(compSide)
- if percent >= 0 and percent < 25 then
- textColor = colors.red
- elseif percent >= 25 and percent < 50 then
- textColor = colors.orange
- elseif percent >= 50 and percent < 75 then
- textColor = colors.yellow
- elseif percent >= 75 then
- textColor = colors.blue
- end
- if percent > 0 then
- pLine = lineMax+1
- else
- pLine = lineMax
- end
- for i = lineMax,yMax do
- mon.setCursorPos(1,i)
- mon.setBackgroundColor(colors.lightBlue)
- mon.write(" ")
- end
- mon.setCursorPos(2,pLine)
- mon.setTextColor(textColor)
- mon.write(percent.."%")
- mon.setBackgroundColor(colors.black)
- mon.setTextColor(colors.white)
- end
- end
- while true do
- sleep(0)
- term.clear()
- term.setCursorPos(1,3)
- comparator()
- screen()
- monitor()
- if genType == "endo" then
- dropItem()
- dropTimer()
- elseif genType == "entro" then
- entropinum()
- end
- term.setTextColor(colors.white)
- sleep(0.5)
- end
Advertisement
Add Comment
Please, Sign In to add comment