OC: Energy Meter 0.3.0
Curse Maven Snippet
What's new
OC: Energy Meter
OC: Energy Meter is a two-block-tall electricity meter for Forge Energy (FE). Put it between a power source and a consumer, and its LCD shows how much energy flows through it right now and how much has gone through in total.
With OpenComputers: Rebooted installed, computers can read the meter too, so you can build power monitors, logs and in-game billing.
Requirements
- Minecraft 1.21.1
- NeoForge 21.1.266 or newer
- Java 21
- OpenComputers: Rebooted 1.9.4-5 or newer (optional)
Features
- Live LCD with the flow in FE per tick and the lifetime total
- GUI with the lifetime total, a resettable session counter and the buffer
- Customer account name field in the GUI, readable from computers for in-game billing
- Only the owner or a server operator can open the GUI or dismantle the meter
- Cannot be mined, blown up or moved by pistons; dismantle it with the Meter Wrench or a Create Wrench
- Counters are saved with the world
- Works with any mod that uses Forge Energy, including Create: Crafts & Additions
How to connect
Both ports are on the back, the side opposite the LCD. Connect the source to the blue port on the back of the lower half and the consumer to the orange port on the back of the upper half. The other sides have no energy ports.
Upgrading from 0.2.x or older: version 0.3.0 moved the ports to the back. Existing meters keep their counters, but you must reconnect their cables.
OpenComputers
Connect an Adapter to the left, right or front of the lower half, or below it
(the back is the input port), and use the energy_meter component:
| Method | Returns |
|---|---|
getRate() |
FE per tick in the last completed tick |
getTotal() |
Lifetime FE (string) |
getSession() |
FE since the last reset (string) |
getBuffer() |
Buffered FE and capacity |
getOwner() |
Name of the player who placed the meter |
getCustomer() |
Customer account name set in the GUI |
getCustomerStart() |
Lifetime FE when the current customer was set (string) |
resetSession() |
Resets the session counter (can be disabled in the config) |
local meter = require("component").energy_meter
print(meter.getCustomer() .. ": " .. meter.getRate() .. " FE/t, total " .. meter.getTotal() .. " FE")
getRate() is in FE per tick. Only the owner or an operator can change the
customer, in the GUI; computers can only read it. When the customer changes,
the meter records the lifetime total, so the old customer is billed up to
getCustomerStart() and the new one from there.
Recipes
| Item | Recipe |
|---|---|
| Energy Meter | 5 gold ingots, 1 glass pane, 2 copper ingots, 1 redstone comparator |
| Meter Wrench | 3 iron ingots, 2 sticks |
For pack makers
- Server and client both need the mod.
- OpenComputers: Rebooted is optional; without it the meter works on its own.
allowOcResetinconfig/ocem-common.toml(defaulttrue) controls whether computers can reset the session counter.
License
MIT.
This mod has no additional files