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
ConstructorsConstructorDescriptionForgeItemEnergyContainer(T container) Creates an instance of aForgeItemEnergyContainerrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanReturns the value of thecontainerrecord component.final booleanIndicates whether some other object is "equal to" this one.intextractEnergy(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) intintfinal inthashCode()Returns a hash code value for this object.intreceiveEnergy(int maxAmount, boolean bl) final StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraftforge.common.capabilities.ICapabilityProvider
getCapability
-
Constructor Details
-
ForgeItemEnergyContainer
Creates an instance of aForgeItemEnergyContainerrecord class.- Parameters:
container- the value for thecontainerrecord 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:
getCapabilityin interfacenet.minecraftforge.common.capabilities.ICapabilityProvider
-
receiveEnergy
public int receiveEnergy(int maxAmount, boolean bl) - Specified by:
receiveEnergyin interfacenet.minecraftforge.energy.IEnergyStorage
-
extractEnergy
public int extractEnergy(int maxAmount, boolean bl) - Specified by:
extractEnergyin interfacenet.minecraftforge.energy.IEnergyStorage
-
getEnergyStored
public int getEnergyStored()- Specified by:
getEnergyStoredin interfacenet.minecraftforge.energy.IEnergyStorage
-
getMaxEnergyStored
public int getMaxEnergyStored()- Specified by:
getMaxEnergyStoredin interfacenet.minecraftforge.energy.IEnergyStorage
-
canExtract
public boolean canExtract()- Specified by:
canExtractin interfacenet.minecraftforge.energy.IEnergyStorage
-
canReceive
public boolean canReceive()- Specified by:
canReceivein interfacenet.minecraftforge.energy.IEnergyStorage
-
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
container
Returns the value of thecontainerrecord component.- Returns:
- the value of the
containerrecord component
-