CARVIEW |
Select Language
HTTP/2 200
date: Sat, 11 Oct 2025 20:20:08 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=b20e15edc67cffb209beaebfd56b2d9c0c715e47b5c188a20f9aff1823f514dba%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22PdIyPfdej3apH0UKOM9zAHJ7TzYG3k42%22%3B%7D; HttpOnly; Path=/
cf-ray: 98d10e6dbe51b080-BLR
-- energyMonitor.lua-- Zeigt den Energieinhalt eines Speichers (rechts) auf ei - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- energyMonitor.lua
- -- Zeigt den Energieinhalt eines Speichers (rechts) auf einem Monitor (oben) an.
- -- Entwickelt für Advanced Computer (CC: Tweaked)
- -- Peripheriegeräte abrufen
- local battery = peripheral.wrap("right")
- local monitor = peripheral.wrap("top")
- if not battery then
- error("❌ Kein Energiespeicher rechts gefunden!")
- end
- if not monitor then
- error("❌ Kein Monitor oben gefunden!")
- end
- -- Monitor vorbereiten
- monitor.setTextScale(1)
- monitor.setBackgroundColor(colors.black)
- monitor.clear()
- monitor.setCursorPos(1,1)
- -- Funktion zum Zeichnen des Fortschrittsbalkens
- local function drawBar(x, y, width, percent)
- local filled = math.floor(width * percent)
- monitor.setCursorPos(x, y)
- monitor.setBackgroundColor(colors.green)
- monitor.write(string.rep(" ", filled))
- monitor.setBackgroundColor(colors.gray)
- monitor.write(string.rep(" ", width - filled))
- monitor.setBackgroundColor(colors.black)
- end
- -- Funktion, um Energie aus verschiedenen Mods zu lesen
- local function getEnergyData(periph)
- local stored, max = 0, 0
- if periph.getEnergyStored and periph.getMaxEnergyStored then
- stored = periph.getEnergyStored()
- max = periph.getMaxEnergyStored()
- elseif periph.getEnergy and periph.getMaxEnergy then
- stored = periph.getEnergy()
- max = periph.getMaxEnergy()
- elseif periph.getStored and periph.getCapacity then
- stored = periph.getStored()
- max = periph.getCapacity()
- else
- error("⚠️ Unbekannte Energie-API – Block unterstützt keine Energieabfrage.")
- end
- return stored, max
- end
- -- Hauptschleife
- while true do
- monitor.clear()
- monitor.setCursorPos(1,1)
- monitor.setTextColor(colors.white)
- local ok, energyStored, energyCapacity = pcall(function()
- local s, m = getEnergyData(battery)
- return s, m
- end)
- if not ok then
- monitor.setTextColor(colors.red)
- monitor.write("Fehler beim Lesen der Energie!")
- sleep(2)
- else
- local percent = (energyCapacity > 0) and (energyStored / energyCapacity) or 0
- local percentText = string.format("%.1f%%", percent * 100)
- monitor.setTextColor(colors.cyan)
- monitor.write("Energie-Speicher")
- monitor.setCursorPos(1,2)
- monitor.setTextColor(colors.white)
- monitor.write(string.format("%d / %d RF", energyStored, energyCapacity))
- monitor.setCursorPos(1,3)
- drawBar(1, 3, 25, percent)
- monitor.setCursorPos(1,5)
- monitor.setTextColor(colors.yellow)
- monitor.write("Fuellstand: " .. percentText)
- end
- sleep(2)
- end
Advertisement
Add Comment
Please, Sign In to add comment
-
📝 Exchange profit method
JavaScript | 1 sec ago | 0.24 KB
-
✅ Make $2500 in 20 minutes⭐⭐⭐ X
JavaScript | 4 sec ago | 0.25 KB
-
⭐ Free Crypto Method ⭐
JavaScript | 10 sec ago | 0.24 KB
-
📌 Swapzone +37% glitch ⭐ O
JavaScript | 13 sec ago | 0.25 KB
-
📝 Crypto Swap Glitch ✅ Working
JavaScript | 20 sec ago | 0.24 KB
-
✅⭐ Make huge profits on trading ⭐⭐ 5
JavaScript | 22 sec ago | 0.25 KB
-
📝 EASY MONEY GUIDE ✅ Working
JavaScript | 29 sec ago | 0.24 KB
-
⭐✅ Marketplace Glitch ✅ Working ✅ NEVER SEEN...
JavaScript | 31 sec ago | 0.25 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand