Interface EnergyHolder


public interface EnergyHolder
Defines the interface for energy holders. If a block, an item, a block-entity implements this interface, it can store energy, accept input or provide output.
Author:
superice666
  • Method Details

    • getName

      @NotNull String getName()
      Returns:
      The name of this energy holder.
    • canAcceptInput

      boolean canAcceptInput(EnergyType energyType)
      Parameters:
      energyType - The type of energy to accept.
      Returns:
      If this energy holder can accept input.
    • canAcceptInput

      default boolean canAcceptInput(EnergyType energyType, BlockFace face)
      Parameters:
      energyType - The type of energy to accept.
      face - The face the energy is coming from.
      Returns:
      If this energy holder can accept inout from the given face, usually used by blocks.
    • canProvideOutput

      boolean canProvideOutput(EnergyType energyType)
      Parameters:
      energyType - The type of energy to provide.
      Returns:
      If this energy holder can provide output.
    • canProvideOutput

      default boolean canProvideOutput(EnergyType energyType, BlockFace face)
      Parameters:
      energyType - The type of energy to provide.
      face - The face the energy is going to.
      Returns:
      If this energy holder can provide output to the given face, usually used by blocks.
    • inputInto

      void inputInto(EnergyType energyType, double amount)
      Parameters:
      energyType - The type of energy to input into this energy holder.
      amount - The amount of energy to input.
    • outputFrom

      void outputFrom(EnergyType energyType, double amount)
      Parameters:
      energyType - The type of energy to output from this energy holder.
      amount - The amount of energy to output.
    • getStoredEnergyType

      @Nullable EnergyType getStoredEnergyType()
      Returns:
      The type of the energy stored in this energy holder. If it can't store any energy, it returns null.
    • getMaxStorage

      double getMaxStorage()
      Returns:
      The max amount of energy that can stored in this energy holder. If it can't store any energy, it returns 0.
    • getStoredEnergy

      double getStoredEnergy()
      Returns:
      The amount of energy stored in this energy holder. If it can't store any energy, it returns 0.