Skip to content

Energy System

DarkBladeDev edited this page May 10, 2026 · 1 revision

⚡ Energy System

The Energy System is a specialized layer built on top of the Wiring System. It provides a standard way to handle power production, consumption, and storage across your multiblock machines.

🏗️ Components

1. Energy Producers

Producers generate energy (e.g., Solar Panels, Generators).

  • Rate: How much energy they produce per tick.
  • Buffer: Internal storage before pushing to the network.

2. Energy Consumers

Consumers use energy to perform tasks (e.g., Electric Furnaces, Miners).

  • Demand: How much they need to operate.
  • Behavior: What happens when they run out of power? (e.g., State changes to INACTIVE).

3. Energy Storage

Storage modules (Batteries, Capacitors) hold energy for later use.

  • Capacity: Maximum energy they can hold.
  • I/O Rate: How fast they can charge or discharge.

🔌 Energy Networks

When producers and consumers are connected via ENERGY type cables, they form an Energy Network.

  • Distribution: The engine automatically distributes power from producers to consumers.
  • Priority: Certain machines can be given higher priority for power.
  • Losses: (Optional) Networks can be configured to have energy loss over distance.

🧱 YAML Integration

While the logic is often handled by Java addons, you can define energy-related variables and states in YAML:

id: electric_furnace
variables:
  energy_stored: 0
  energy_capacity: 10000

actions:
  on_tick:
    - type: conditional
      conditions:
        - type: variable
          key: energy_stored
          value: 10
          comparison: GREATER_OR_EQUAL
      then:
        # Perform work and consume energy
        - type: modify_variable
          key: energy_stored
          operation: SUBTRACT
          amount: 10

💻 Developer API

Accessing the energy system in Java:

@InjectService
private EnergyService energyService;

public void chargeMachine(MultiblockInstance instance, double amount) {
    EnergyStorage storage = energyService.getStorage(instance);
    storage.receiveEnergy(amount, false);
}

Key Interfaces

  • EnergyProducer: Implement for generating power.
  • EnergyConsumer: Implement for using power.
  • EnergyStorage: Implement for storing power.

Clone this wiki locally