Record Class ForgeEnergyContainer.ForgeEnergyStorage<T extends EnergyContainer & Updatable>
java.lang.Object
java.lang.Record
earth.terrarium.botarium.forge.energy.ForgeEnergyContainer.ForgeEnergyStorage<T>
- All Implemented Interfaces:
AutoSerializable,net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>,net.minecraftforge.energy.IEnergyStorage
- Enclosing class:
- ForgeEnergyContainer
public static record ForgeEnergyContainer.ForgeEnergyStorage<T extends EnergyContainer & Updatable>(T extends EnergyContainer & Updatable container)
extends Record
implements net.minecraftforge.energy.IEnergyStorage, AutoSerializable
-
Constructor Summary
ConstructorsConstructorDescriptionForgeEnergyStorage(T container) Creates an instance of aForgeEnergyStoragerecord 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) 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 earth.terrarium.botarium.forge.AutoSerializable
deserializeNBT, serializeNBT
-
Constructor Details
-
ForgeEnergyStorage
Creates an instance of aForgeEnergyStoragerecord class.- Parameters:
container- the value for thecontainerrecord component
-
-
Method Details
-
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
-
getSerializable
- Specified by:
getSerializablein interfaceAutoSerializable
-
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
-