Record Class SidedEnergyStorage
java.lang.Object
java.lang.Record
com.portingdeadmods.portingdeadlibs.api.capabilities.SidedEnergyStorage
- All Implemented Interfaces:
net.neoforged.neoforge.energy.IEnergyStorage
-
Constructor Summary
ConstructorsConstructorDescriptionSidedEnergyStorage(net.neoforged.neoforge.energy.IEnergyStorage innerHandler, IOAction action) Creates an instance of aSidedEnergyStoragerecord class.SidedEnergyStorage(net.neoforged.neoforge.energy.IEnergyStorage innerHandler, it.unimi.dsi.fastutil.Pair<IOAction, int[]> actionSlotsPair) -
Method Summary
Modifier and TypeMethodDescriptionaction()Returns the value of theactionrecord component.booleanbooleanfinal booleanIndicates whether some other object is "equal to" this one.intextractEnergy(int toExtract, boolean simulate) intintfinal inthashCode()Returns a hash code value for this object.net.neoforged.neoforge.energy.IEnergyStorageReturns the value of theinnerHandlerrecord component.intreceiveEnergy(int toReceive, boolean simulate) final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
SidedEnergyStorage
public SidedEnergyStorage(net.neoforged.neoforge.energy.IEnergyStorage innerHandler, it.unimi.dsi.fastutil.Pair<IOAction, int[]> actionSlotsPair) -
SidedEnergyStorage
public SidedEnergyStorage(net.neoforged.neoforge.energy.IEnergyStorage innerHandler, IOAction action) Creates an instance of aSidedEnergyStoragerecord class.- Parameters:
innerHandler- the value for theinnerHandlerrecord componentaction- the value for theactionrecord component
-
-
Method Details
-
receiveEnergy
public int receiveEnergy(int toReceive, boolean simulate) - Specified by:
receiveEnergyin interfacenet.neoforged.neoforge.energy.IEnergyStorage
-
extractEnergy
public int extractEnergy(int toExtract, boolean simulate) - Specified by:
extractEnergyin interfacenet.neoforged.neoforge.energy.IEnergyStorage
-
getEnergyStored
public int getEnergyStored()- Specified by:
getEnergyStoredin interfacenet.neoforged.neoforge.energy.IEnergyStorage
-
getMaxEnergyStored
public int getMaxEnergyStored()- Specified by:
getMaxEnergyStoredin interfacenet.neoforged.neoforge.energy.IEnergyStorage
-
canExtract
public boolean canExtract()- Specified by:
canExtractin interfacenet.neoforged.neoforge.energy.IEnergyStorage
-
canReceive
public boolean canReceive()- Specified by:
canReceivein interfacenet.neoforged.neoforge.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). -
innerHandler
public net.neoforged.neoforge.energy.IEnergyStorage innerHandler()Returns the value of theinnerHandlerrecord component.- Returns:
- the value of the
innerHandlerrecord component
-
action
Returns the value of theactionrecord component.- Returns:
- the value of the
actionrecord component
-