Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --##################--
- -- Programm von endminecraffter
- -- https://pastebin.com/u/endminecraffter
- -- Server: MyFTB.de Deutsches Minecraft modded Netzwerk
- -- Benoetigte Mods/Apis: Mod Draconic Evolution , API bars(mWcHuiKX)
- -- Mon Size: Y: min 4 X: min 5
- --##################--
- function wrapPs(peripheralName)
- periTab={}
- sideTab={}
- if peripheralName==nil then
- print("Fehler")
- end
- local peripherals = peripheral.getNames()
- local i2 = 1
- for i =1, #peripherals do
- if peripheral.getType(peripherals[i])==peripheralName then
- periTab[i2]=peripheral.wrap(peripherals[i])
- sideTab[i2]=peripherals[i]
- i2=i2+1
- end
- end
- if periTab~={} then
- return periTab,sideTab
- else
- return nil
- end
- end
- os.loadAPI("bars")
- mon = peripheral.wrap("top")
- mon.setBackgroundColor(colors.black)
- mon.clear()
- monitor = peripheral.wrap("top")
- local linkupdate = http.get("http://computercraft.mineagame.eu/index.html")
- local update = linkupdate.readAll()
- version = "1.3.2"
- PM = "-"
- tier = "1"
- label = "endEnergyMonitor"
- core = wrapPs("draconic_rf_storage")[1]
- monX, monY = mon.getSize()
- function loadmon()
- mon.setCursorPos(22,1)
- mon.write(label)
- mon.setCursorPos(2,4)
- mon.write("Tier ".. tier)
- mon.setCursorPos(19,26)
- mon.write("Ene")
- mon.setCursorPos(30,26)
- mon.write("Tra")
- mon.setCursorPos(39,4)
- mon.write("Energy:")
- mon.setCursorPos(38,6)
- mon.write("Transfer:")
- mon.setCursorPos(35,5)
- local energyStored = core.getEnergyStored()
- local energyMax = core.getMaxEnergyStored()
- if energyStored < 1000 then
- mon.write(energyStored)
- elseif energyStored < 1000000 then
- mon.write(round((energyStored/1000),1))
- mon.write("k")
- elseif energyStored < 1000000000 then
- mon.write(round((energyStored/1000000),1))
- mon.write("M")
- elseif energyStored < 1000000000000 then
- mon.write(round((energyStored/1000000000),1))
- mon.write("G")
- elseif energyStored < 1000000000000000 then
- mon.write(round((energyStored/1000000000000),1))
- mon.write("T")
- elseif energyStored < 1000000000000000000 then
- mon.write(round((energyStored/1000000000000000),1))
- mon.write("P")
- elseif energyStored < 1000000000000000000000 then
- mon.write(round((energyStored/1000000000000000000),1))
- mon.write("E")
- end
- mon.write(" / ")
- if energyMax < 1000 then
- mon.write(energyMax)
- elseif energyMax < 1000000 then
- mon.write(round((energyMax/1000),1))
- mon.write("k")
- elseif energyMax < 1000000000 then
- mon.write(round((energyMax/1000000),1))
- mon.write("M")
- elseif energyMax < 1000000000000 then
- mon.write(round((energyMax/1000000000),1))
- mon.write("G")
- elseif energyMax < 1000000000000000 then
- mon.write(round((energyMax/1000000000000),1))
- mon.write("T")
- elseif energyMax < 1000000000000000000 then
- mon.write(round((energyMax/1000000000000000 ),1))
- mon.write("P")
- elseif energyMax < 1000000000000000000000 then
- mon.write(round((energyMax/1000000000000000000),1))
- mon.write("E")
- end
- mon.write("RF")
- mon.setCursorPos(39,7)
- if PM == "-" then
- mon.setTextColor(colors.red)
- mon.write("-".. getTransfer())
- mon.setTextColor(colors.white)
- elseif PM == "+" then
- mon.setTextColor(colors.green)
- mon.write("+".. getTransfer())
- mon.setTextColor(colors.white)
- end
- end
- function getTier()
- local energyMax = core.getMaxEnergyStored()
- if energyMax < 50000000 then
- tier = 1
- elseif energyMax < 300000000 then
- tier = 2
- elseif energyMax < 2000000000 then
- tier = 3
- elseif energyMax < 10000000000 then
- tier = 4
- elseif energyMax < 60000000000 then
- tier = 5
- elseif energyMax < 500000000000 then
- tier = 6
- elseif energyMax < 3000000000000 then
- tier = 7
- else
- tier = 8
- end
- end
- --if energy1 <= energy2 then
- --PM = "+"
- --else if energy1 >= energy2 then
- --PM = "-"
- --end
- --end
- function getTransfer()
- energy1 = core.getEnergyStored()
- sleep(0.02)
- energy2 = core.getEnergyStored()
- if energy1 <= energy2 then
- energyP = energy2 - energy1
- PM = "+"
- return energyP
- else if energy1 >= energy2 then
- PM = "-"
- energyM = energy1 - energy2
- return energyM
- end
- end
- end
- function drawBox(xMin, xMax, yMin, yMax, title, bcolor, tcolor)
- mon.setBackgroundColor(bcolor)
- for xPos = xMin, xMax, 1 do
- mon.setCursorPos(xPos, yMin)
- mon.write(" ")
- end
- for yPos = yMin, yMax, 1 do
- mon.setCursorPos(xMin, yPos)
- mon.write(" ")
- mon.setCursorPos(xMax, yPos)
- mon.write(" ")
- end
- for xPos = xMin, xMax, 1 do
- mon.setCursorPos(xPos, yMax)
- mon.write(" ")
- end
- mon.setCursorPos(xMin+2, yMin)
- mon.setBackgroundColor(colors.black)
- mon.setTextColor(tcolor)
- mon.write(" ")
- mon.write(title)
- mon.write(" ")
- mon.setTextColor(colors.white)
- end
- function drawBoxes()
- drawBox(1,17,3,15,"Core", colors.gray, colors.lightGray)
- drawBox(34,50,3,15,"Stats", colors.gray, colors.lightGray)
- end
- function addBars()
- bars.add("E", "ver", core.getMaxEnergyStored(), round(core.getEnergyStored()-core.getMaxEnergyStored()), 20, 3, 0, 23
- , colors.gray, colors.green)
- bars.add("T", "ver", 2000000, 2000000, 31, 3, 0, 23 , colors.gray, colors.green)
- bars.screen()
- end
- bars.construct(monitor)
- function round(num, idp)
- local mult = 10^(idp or 0)
- return math.floor(num * mult + 0.5) / mult
- end
- local function drawL1(xPos, yPos)
- mon.setCursorPos(xPos, yPos)
- mon.setBackgroundColor(colorCore)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+1)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+2)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+3)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+4)
- mon.setBackgroundColor(colorShield)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+5)
- mon.setBackgroundColor(colorCore)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+6)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+7)
- mon.setBackgroundColor(colorShield)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+8)
- mon.setBackgroundColor(colorCore)
- mon.write(" ")
- end
- local function drawL2(xPos, yPos)
- mon.setCursorPos(xPos, yPos)
- mon.setBackgroundColor(colorCore)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+1)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+2)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+3)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+4)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+5)
- mon.setBackgroundColor(colorShield)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+6)
- mon.setBackgroundColor(colorCore)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+7)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+8)
- mon.write(" ")
- end
- local function drawL3(xPos, yPos)
- mon.setCursorPos(xPos, yPos)
- mon.setBackgroundColor(colorCore)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+1)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+2)
- mon.setBackgroundColor(colorShield)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+3)
- mon.setBackgroundColor(colorCore)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+4)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+5)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+6)
- mon.setBackgroundColor(colorShield)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+7)
- mon.setBackgroundColor(colorCore)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+8)
- mon.write(" ")
- end
- local function drawL4(xPos, yPos)
- mon.setCursorPos(xPos, yPos)
- mon.setBackgroundColor(colorCore)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+1)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+2)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+3)
- mon.setBackgroundColor(colorShield)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+4)
- mon.setBackgroundColor(colorCore)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+5)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+6)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+7)
- mon.setBackgroundColor(colorShield)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+8)
- mon.setBackgroundColor(colorCore)
- mon.write(" ")
- end
- local function drawL5(xPos, yPos)
- mon.setCursorPos(xPos, yPos)
- mon.setBackgroundColor(colorShield)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+1)
- mon.setBackgroundColor(colorCore)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+2)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+3)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+4)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+5)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+6)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+7)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+8)
- mon.write(" ")
- end
- local function drawL6(xPos, yPos)
- mon.setCursorPos(xPos, yPos)
- mon.setBackgroundColor(colorCore)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+1)
- mon.setBackgroundColor(colorShield)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+2)
- mon.setBackgroundColor(colorCore)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+3)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+4)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+5)
- mon.setBackgroundColor(colorShield)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+6)
- mon.setBackgroundColor(colorCore)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+7)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+8)
- mon.write(" ")
- end
- local function drawL7(xPos, yPos)
- mon.setCursorPos(xPos, yPos)
- mon.setBackgroundColor(colorCore)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+1)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+2)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+3)
- mon.setBackgroundColor(colorShield)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+4)
- mon.setBackgroundColor(colorCore)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+5)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+6)
- mon.setBackgroundColor(colorShield)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+7)
- mon.setBackgroundColor(colorCore)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+8)
- mon.setBackgroundColor(colorShield)
- mon.write(" ")
- end
- local function drawL8(xPos, yPos)
- mon.setCursorPos(xPos, yPos)
- mon.setBackgroundColor(colorCore)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+1)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+2)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+3)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+4)
- mon.setBackgroundColor(colorShield)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+5)
- mon.setBackgroundColor(colorCore)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+6)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+7)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+8)
- mon.write(" ")
- end
- local function drawL9(xPos, yPos)
- mon.setCursorPos(xPos, yPos)
- mon.setBackgroundColor(colorCore)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+1)
- mon.setBackgroundColor(colorShield)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+2)
- mon.setBackgroundColor(colorCore)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+3)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+4)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+5)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+6)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+7)
- mon.setBackgroundColor(colorShield)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+8)
- mon.setBackgroundColor(colorCore)
- mon.write(" ")
- end
- local function drawL10(xPos, yPos)
- mon.setCursorPos(xPos, yPos)
- mon.setBackgroundColor(colorCore)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+1)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+2)
- mon.setBackgroundColor(colorShield)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+3)
- mon.setBackgroundColor(colorCore)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+4)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+5)
- mon.setBackgroundColor(colorShield)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+6)
- mon.setBackgroundColor(colorCore)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+7)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+8)
- mon.setBackgroundColor(colorShield)
- mon.write(" ")
- end
- local function drawL11(xPos, yPos)
- mon.setCursorPos(xPos, yPos)
- mon.setBackgroundColor(colorCore)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+1)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+2)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+3)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+4)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+5)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+6)
- mon.setBackgroundColor(colorShield)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+7)
- mon.setBackgroundColor(colorCore)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+8)
- mon.write(" ")
- end
- local function drawL12(xPos, yPos)
- mon.setCursorPos(xPos, yPos)
- mon.setBackgroundColor(colorShield)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+1)
- mon.setBackgroundColor(colorCore)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+2)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+3)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+4)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+5)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+6)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+7)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+8)
- mon.write(" ")
- end
- local function drawL13(xPos, yPos)
- mon.setCursorPos(xPos, yPos)
- mon.setBackgroundColor(colorCore)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+1)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+2)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+3)
- mon.setBackgroundColor(colorShield)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+4)
- mon.setBackgroundColor(colorCore)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+5)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+6)
- mon.setBackgroundColor(colorShield)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+7)
- mon.setBackgroundColor(colorCore)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+8)
- mon.write(" ")
- end
- function loadBall()
- colorCore = colors.cyan
- colorShield = colors.lightBlue
- if Tier == "8" then
- colorCore = colors.orange
- colorShield = colors.red
- end
- yPos = 5
- xPos = 3
- drawL1(xPos,yPos)
- drawL2(xPos+1,yPos)
- drawL3(xPos+2,yPos)
- drawL4(xPos+3,yPos)
- drawL5(xPos+4,yPos)
- drawL6(xPos+5,yPos)
- drawL7(xPos+6,yPos)
- drawL8(xPos+7,yPos)
- drawL9(xPos+8,yPos)
- drawL10(xPos+9,yPos)
- drawL11(xPos+10,yPos)
- drawL12(xPos+11,yPos)
- drawL13(xPos+12,yPos)
- mon.setBackgroundColor(colors.black)
- mon.setCursorPos(xPos, yPos)
- mon.write(" ")
- mon.setCursorPos(xPos+10, yPos)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+1)
- mon.write(" ")
- mon.setCursorPos(xPos+12, yPos+1)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+7)
- mon.write(" ")
- mon.setCursorPos(xPos+12, yPos+7)
- mon.write(" ")
- mon.setCursorPos(xPos, yPos+8)
- mon.write(" ")
- mon.setCursorPos(xPos+10, yPos+8)
- mon.write(" ")
- end
- function checkupdate()
- print("Aktuelle Version: ".. version)
- print("Neuste Version: ".. update)
- end
- checkupdate()
- loadBall()
- addBars()
- drawBoxes()
- getTier()
- term.write(round(2000000 - getTransfer()))
- while true do
- getTransfer()
- loadmon()
- bars.set("E", "cur", round(core.getMaxEnergyStored()-core.getEnergyStored()) - 1)
- if PM == "-" then
- bars.set("T", "cur", 2000000)
- elseif PM == "+" then
- bars.set("T", "cur", round(2000000 - getTransfer()) - 1)
- end
- bars.screen()
- sleep(0.01)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement