Interface IEnergyStorage

All Known Implementing Classes:
ComponentEnergyStorage, EmptyEnergyStorage, EnergyStorage

public interface IEnergyStorage
An energy storage is the unit of interaction with Energy inventories.

A reference implementation can be found at EnergyStorage. Derived from the Redstone Flux power system designed by King Lemming and originally utilized in Thermal Expansion and related mods. Created with consent and permission of King Lemming and Team CoFH. Released with permission under LGPL 2.1 when bundled with Forge.

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns if this storage can have energy extracted.
    boolean
    Used to determine if this storage can receive energy.
    int
    extractEnergy(int toExtract, boolean simulate)
    Removes energy from the storage.
    int
    Returns the amount of energy currently stored.
    int
    Returns the maximum amount of energy that can be stored.
    int
    receiveEnergy(int toReceive, boolean simulate)
    Adds energy to the storage.
  • Method Details

    • receiveEnergy

      int receiveEnergy(int toReceive, boolean simulate)
      Adds energy to the storage. Returns the amount of energy that was accepted.
      Parameters:
      toReceive - The amount of energy being received.
      simulate - If true, the insertion will only be simulated, meaning getEnergyStored() will not change.
      Returns:
      Amount of energy that was (or would have been, if simulated) accepted by the storage.
    • extractEnergy

      int extractEnergy(int toExtract, boolean simulate)
      Removes energy from the storage. Returns the amount of energy that was removed.
      Parameters:
      toExtract - The amount of energy being extracted.
      simulate - If true, the extraction will only be simulated, meaning getEnergyStored() will not change.
      Returns:
      Amount of energy that was (or would have been, if simulated) extracted from the storage.
    • getEnergyStored

      int getEnergyStored()
      Returns the amount of energy currently stored.
    • getMaxEnergyStored

      int getMaxEnergyStored()
      Returns the maximum amount of energy that can be stored.
    • canExtract

      boolean canExtract()
      Returns if this storage can have energy extracted. If this is false, then any calls to extractEnergy will return 0.
    • canReceive

      boolean canReceive()
      Used to determine if this storage can receive energy. If this is false, then any calls to receiveEnergy will return 0.