类 EnergyStorage

java.lang.Object
net.neoforged.neoforge.energy.EnergyStorage
所有已实现的接口:
ValueIOSerializable, IEnergyStorage

public class EnergyStorage extends Object implements IEnergyStorage, ValueIOSerializable
Reference implementation of IEnergyStorage. Use/extend this or implement your own. 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.
  • 字段详细资料

    • energy

      protected int energy
    • capacity

      protected int capacity
    • maxReceive

      protected int maxReceive
    • maxExtract

      protected int maxExtract
  • 构造器详细资料

    • EnergyStorage

      public EnergyStorage(int capacity)
    • EnergyStorage

      public EnergyStorage(int capacity, int maxTransfer)
    • EnergyStorage

      public EnergyStorage(int capacity, int maxReceive, int maxExtract)
    • EnergyStorage

      public EnergyStorage(int capacity, int maxReceive, int maxExtract, int energy)
  • 方法详细资料

    • receiveEnergy

      public int receiveEnergy(int toReceive, boolean simulate)
      从接口复制的说明: IEnergyStorage
      Adds energy to the storage. Returns the amount of energy that was accepted.
      指定者:
      receiveEnergy 在接口中 IEnergyStorage
      参数:
      toReceive - The amount of energy being received.
      simulate - If true, the insertion will only be simulated, meaning IEnergyStorage.getEnergyStored() will not change.
      返回:
      Amount of energy that was (or would have been, if simulated) accepted by the storage.
    • extractEnergy

      public int extractEnergy(int toExtract, boolean simulate)
      从接口复制的说明: IEnergyStorage
      Removes energy from the storage. Returns the amount of energy that was removed.
      指定者:
      extractEnergy 在接口中 IEnergyStorage
      参数:
      toExtract - The amount of energy being extracted.
      simulate - If true, the extraction will only be simulated, meaning IEnergyStorage.getEnergyStored() will not change.
      返回:
      Amount of energy that was (or would have been, if simulated) extracted from the storage.
    • getEnergyStored

      public int getEnergyStored()
      从接口复制的说明: IEnergyStorage
      Returns the amount of energy currently stored.
      指定者:
      getEnergyStored 在接口中 IEnergyStorage
    • getMaxEnergyStored

      public int getMaxEnergyStored()
      从接口复制的说明: IEnergyStorage
      Returns the maximum amount of energy that can be stored.
      指定者:
      getMaxEnergyStored 在接口中 IEnergyStorage
    • canExtract

      public boolean canExtract()
      从接口复制的说明: IEnergyStorage
      Returns if this storage can have energy extracted. If this is false, then any calls to extractEnergy will return 0.
      指定者:
      canExtract 在接口中 IEnergyStorage
    • canReceive

      public boolean canReceive()
      从接口复制的说明: IEnergyStorage
      Used to determine if this storage can receive energy. If this is false, then any calls to receiveEnergy will return 0.
      指定者:
      canReceive 在接口中 IEnergyStorage
    • serialize

      public void serialize(ValueOutput output)
      指定者:
      serialize 在接口中 ValueIOSerializable
    • deserialize

      public void deserialize(ValueInput input)
      指定者:
      deserialize 在接口中 ValueIOSerializable