Need to manage your energy? Now you can!
You can get from the network all your energy, and network stats
Yes, I just want to get the base features before porting it to newer versions
Yes you can! All my mods can go into modpacks of your liking
Due to CC: Tweaked updates, you will need to download CC: Tweaked from https://modrinth.com/mod/cc-tweaked
Here is an example using this mod:
local flux = peripheral.find("flux_controller") -- Find a flux controller
local monitor = peripheral.find("monitor") -- Find a monitor
monitor.clear() -- Clear the monitor
local line = 0 -- Start
local function write(toWrite, color)
line = line + 1
-- If the color param is not given, default to white
if color == nil then
color = 0x1 -- this is white
end
monitor.setTextColor(color)
monitor.setCursorPos(1, line)
monitor.write(toWrite)
monitor.setTextColor(0x1)
end
-- This function turns numbers from 194168 to 192,168 for example
local function format_number(n)
local formatted = tostring(n)
local k
while true do
formatted, k = formatted:gsub("^(-?%d+)(%d%d%d)", '%1,%2')
if k == 0 then break end
end
return formatted
end
while true do
local stats = flux.networkStats()
write(format_number(flux.getEnergy()) .. " / " .. format_number(flux.getEnergyCapacity()) .. " FE")
write()
write("Controllers: ".. stats.controllerCount)
write("Points: ".. stats.pointCount)
write("Storages: ".. stats.storageCount)
write("Buffer: ".. stats.totalBuffer)
write("Total Energy: ".. stats.totalEnergy)
write("Energy Input: ".. stats.energyInput)
write("Energy Output: ".. stats.energyOutput)
write("Average Tick: ".. stats.averageTick)
write("Connection Count: ".. stats.connectionCount)
line = 0 -- reset line count. Handeled in the write function
end