Class UnlimitedEnergyContainer

java.lang.Object
earth.terrarium.botarium.common.energy.impl.UnlimitedEnergyContainer
All Implemented Interfaces:
EnergyContainer, Serializable, Updatable, net.minecraft.world.Clearable

public class UnlimitedEnergyContainer extends Object implements EnergyContainer, Updatable
  • Constructor Details

    • UnlimitedEnergyContainer

      public UnlimitedEnergyContainer()
  • Method Details

    • insertEnergy

      public long insertEnergy(long maxAmount, boolean simulate)
      Description copied from interface: EnergyContainer
      Inserts a given amount of energy into the container.
      Specified by:
      insertEnergy in interface EnergyContainer
      Parameters:
      maxAmount - The amount to be inserted into the container.
      simulate - If true, the container will not be modified.
      Returns:
      The amount of energy that was added to the container.
    • extractEnergy

      public long extractEnergy(long maxAmount, boolean simulate)
      Description copied from interface: EnergyContainer
      Extracts a given amount of energy into the container.
      Specified by:
      extractEnergy in interface EnergyContainer
      Parameters:
      maxAmount - The amount to be extracted from the container.
      simulate - If true, the container will not be modified.
      Returns:
      The amount of energy that was removed from the container.
    • setEnergy

      public void setEnergy(long energy)
      Description copied from interface: EnergyContainer
      Sets a given amount of energy in the container.
      Specified by:
      setEnergy in interface EnergyContainer
      Parameters:
      energy - The amount of energy to set in the container.
    • getStoredEnergy

      public long getStoredEnergy()
      Specified by:
      getStoredEnergy in interface EnergyContainer
      Returns:
      The amount of energy in the container.
    • getMaxCapacity

      public long getMaxCapacity()
      Specified by:
      getMaxCapacity in interface EnergyContainer
      Returns:
      The maximum amount of energy that can be stored in the container.
    • maxInsert

      public long maxInsert()
      Specified by:
      maxInsert in interface EnergyContainer
      Returns:
      The maximum amount of energy that can be inserted into the container at a time.
    • maxExtract

      public long maxExtract()
      Specified by:
      maxExtract in interface EnergyContainer
      Returns:
      The maximum amount of energy that can be extracted from the container at a time.
    • allowsInsertion

      public boolean allowsInsertion()
      Specified by:
      allowsInsertion in interface EnergyContainer
      Returns:
      Whether the container allows for energy to be inserted.
    • allowsExtraction

      public boolean allowsExtraction()
      Specified by:
      allowsExtraction in interface EnergyContainer
      Returns:
      Whether the container allows for energy to be extracted.
    • createSnapshot

      public EnergySnapshot createSnapshot()
      Specified by:
      createSnapshot in interface EnergyContainer
      Returns:
      A EnergySnapshot of the given state of the EnergyContainer.
    • deserialize

      public void deserialize(net.minecraft.nbt.CompoundTag nbt)
      Description copied from interface: Serializable
      Deserializes the information of an object from a CompoundTag.
      Specified by:
      deserialize in interface Serializable
      Parameters:
      nbt - The CompoundTag to deserialize from.
    • serialize

      public net.minecraft.nbt.CompoundTag serialize(net.minecraft.nbt.CompoundTag nbt)
      Description copied from interface: Serializable
      Serializes the information of an object to a CompoundTag.
      Specified by:
      serialize in interface Serializable
      Parameters:
      nbt - The CompoundTag to serialize to.
      Returns:
      The CompoundTag that was passed in but with the information of the object serialized added to it.
    • update

      public void update()
      Description copied from interface: Updatable
      Called when the operation has been completed and the data has been updated.
      Specified by:
      update in interface Updatable
    • clearContent

      public void clearContent()
      Specified by:
      clearContent in interface net.minecraft.world.Clearable