Skip to main content
General Mechanics uses the NeoForge Energy capability system for all power storage and transfer. Energy is measured in FE (Forge Energy), also referred to as RF (Redstone Flux) in older literature — the unit is identical.
General Mechanics uses NeoForge energy capabilities (net.neoforged.neoforge.energy). Machines expose their energy storage through the standard NeoForge capability system, making them compatible with any other mod that supports Forge Energy.

CoreEnergyStorage

CoreEnergyStorage extends NeoForge’s built-in EnergyStorage and adds mutable setters for live capacity and stored energy adjustments:
public class CoreEnergyStorage extends EnergyStorage {

    // capacity == maxReceive == maxExtract
    public CoreEnergyStorage(int capacity) { ... }

    // Separate receive and extract rates
    public CoreEnergyStorage(int capacity, int maxTransfer) { ... }

    // Full control
    public CoreEnergyStorage(int capacity, int maxReceive, int maxExtract) { ... }

    // Full control with initial energy
    public CoreEnergyStorage(int capacity, int maxReceive, int maxExtract, int energy) { ... }

    // Override stored energy (bypasses transfer limits)
    public void setStored(int energy) { this.energy = energy; }

    // Resize the buffer at runtime
    public void setMaxStorage(int capacity) { this.capacity = capacity; }
}
The setStored() and setMaxStorage() methods are useful for machine upgrades or data loading from NBT.

PoweredBlock Interface

Any block entity that holds a CoreEnergyStorage implements PoweredBlock:
public interface PoweredBlock {
    CoreEnergyStorage getEnergyStorage();
}
This interface is the minimal contract for blocks that participate in the energy network. BasePoweredBlockEntity (the base class for all powered block entities in the mod) implements PoweredBlock and exposes the storage via the NeoForge energy capability.

EnergizedCrafter Interface

EnergizedCrafter<T extends Recipe<?>> extends both Crafter<T> and the energy contract, describing a machine that consumes FE to advance a crafting process:
public interface EnergizedCrafter<T extends Recipe<?>> extends Crafter<T> {

    // Returns true if current stored energy >= required
    boolean hasEnoughEnergy(int required);

    // FE consumed per tick while crafting
    int getEnergyAmount();

    // Slot insertion helpers
    default boolean canInsertItem(ItemStackHandler inventory, Item item, int slot) { ... }
    default boolean canInsertAmount(int count, int fromSlot, int toSlot, CoreItemStackHandler inventory) { ... }
}

BaseEnergyCrafter

BaseEnergyCrafter<T extends CoreRecipe<?>> is the abstract base class for all powered crafting machines. It wires together EnergizedCrafter, PoweredBlock, and sided item I/O:
public abstract class BaseEnergyCrafter<T extends CoreRecipe<?>> 
        extends BasePoweredBlockEntity 
        implements EnergizedCrafter<T>, ISidedItemAccess {

    public abstract Range getInputSlots();
    public abstract Range getOutputSlots();
}

Tick Loop

On every server tick, BaseEnergyCrafter.tick() runs the following logic:
  1. Bail out if !isEnabled() or redstone signal prevents running.
  2. Look up a matching recipe for the current inventory contents.
  3. Check hasEnoughEnergy(getEnergyAmount()).
  4. If all conditions pass: call increaseCraftingProgress(), extract getEnergyAmount() FE from the storage, and call setChanged().
  5. When hasFinished() returns true: craft the item, reset progress to 0.
  6. If conditions fail mid-craft: reset progress to 0.
  7. Update POWERED block state to reflect active/inactive status.

Machine States

MachineStateMeaning
ACTIVECrafting in progress
INACTIVEIdle — no recipe, no inputs, or redstone blocked
ERROREnergy empty, output slot full, or machine disabled

Energy in Practice

Matter Fabricator Example

The Matter Fabricator is a concrete implementation:
// Configured in MatterFabricatorBlockEntity constructor:
Attribute.Builder.of(Keys.MAX_POWER, 100_000)  // 100,000 FE buffer
Attribute.Builder.of(Keys.MAX_DRAIN, 256)       // accepts up to 256 FE/t

@Override
public int getEnergyAmount() {
    return 8; // consumes 8 FE per crafting tick
}
At 8 FE/t the full 100,000 FE buffer lasts 12,500 ticks (≈ 10 minutes) of continuous operation.

Energy Transfer

Machines accept energy from adjacent blocks that push FE via the NeoForge energy capability. There is no built-in cable block in the core module — use a compatible energy cable from another mod or child module.

Power Infrastructure Tips

  • Always check CoreEnergyStorage.getMaxEnergyStored() when sizing generators — machines have hard-coded buffer limits.
  • The MAX_DRAIN attribute on BasePoweredBlockEntity controls the maximum FE accepted per tick. Feeding a machine faster than MAX_DRAIN wastes the surplus.
  • Progress resets to zero if power is cut mid-craft. Keep your buffers full to avoid wasted cycles.
  • setStored() bypasses transfer rate limits and is intended for NBT loading or debugging, not normal gameplay automation.

Build docs developers (and LLMs) love