Record Class ForgeItemEnergyContainer<T extends EnergyContainer & Updatable>

java.lang.Object
java.lang.Record
earth.terrarium.botarium.forge.energy.ForgeItemEnergyContainer<T>
All Implemented Interfaces:
net.minecraftforge.common.capabilities.ICapabilityProvider, net.minecraftforge.energy.IEnergyStorage

public record ForgeItemEnergyContainer<T extends EnergyContainer & Updatable>(T extends EnergyContainer & Updatable container) extends Record implements net.minecraftforge.energy.IEnergyStorage, net.minecraftforge.common.capabilities.ICapabilityProvider
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an instance of a ForgeItemEnergyContainer record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    boolean
     
    Returns the value of the container record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    int
    extractEnergy(int maxAmount, boolean bl)
     
    <T> @NotNull net.minecraftforge.common.util.LazyOptional<T>
    getCapability(@NotNull net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable net.minecraft.core.Direction arg)
     
    int
     
    int
     
    final int
    Returns a hash code value for this object.
    int
    receiveEnergy(int maxAmount, boolean bl)
     
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface net.minecraftforge.common.capabilities.ICapabilityProvider

    getCapability
  • Constructor Details

    • ForgeItemEnergyContainer

      public ForgeItemEnergyContainer(T container)
      Creates an instance of a ForgeItemEnergyContainer record class.
      Parameters:
      container - the value for the container record component
  • Method Details

    • getCapability

      @NotNull public <T> @NotNull net.minecraftforge.common.util.LazyOptional<T> getCapability(@NotNull @NotNull net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable @Nullable net.minecraft.core.Direction arg)
      Specified by:
      getCapability in interface net.minecraftforge.common.capabilities.ICapabilityProvider
    • receiveEnergy

      public int receiveEnergy(int maxAmount, boolean bl)
      Specified by:
      receiveEnergy in interface net.minecraftforge.energy.IEnergyStorage
    • extractEnergy

      public int extractEnergy(int maxAmount, boolean bl)
      Specified by:
      extractEnergy in interface net.minecraftforge.energy.IEnergyStorage
    • getEnergyStored

      public int getEnergyStored()
      Specified by:
      getEnergyStored in interface net.minecraftforge.energy.IEnergyStorage
    • getMaxEnergyStored

      public int getMaxEnergyStored()
      Specified by:
      getMaxEnergyStored in interface net.minecraftforge.energy.IEnergyStorage
    • canExtract

      public boolean canExtract()
      Specified by:
      canExtract in interface net.minecraftforge.energy.IEnergyStorage
    • canReceive

      public boolean canReceive()
      Specified by:
      canReceive in interface net.minecraftforge.energy.IEnergyStorage
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • container

      public T container()
      Returns the value of the container record component.
      Returns:
      the value of the container record component