Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Ensure the peripheral API is enabled
- local energyCube = peripheral.wrap("bottom") -- Wrap the Mekanism Energy Cube on the bottom side
- if not energyCube then
- error("No Mekanism Energy Cube found below the computer!")
- end
- while true do
- -- Get the current energy level and the maximum energy capacity
- local energy = energyCube.getEnergy()
- local maxEnergy = energyCube.getMaxEnergy()
- -- Calculate the energy percentage
- local energyPercentage = (energy / maxEnergy) * 100
- if energyPercentage < 10 then
- -- Turn on the redstone signal to the side
- redstone.setOutput("left", true)
- elseif energyPercentage > 95 then
- -- Turn off the redstone signal to the side
- redstone.setOutput("left", false)
- end
- -- Wait for a short period before checking again
- sleep(5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement