Package top.girlkisser.lazuli.api.energy
Class ProtectiveEnergyStorage
java.lang.Object
net.neoforged.neoforge.energy.EnergyStorage
top.girlkisser.lazuli.api.energy.LazuliEnergyStorage
top.girlkisser.lazuli.api.energy.ProtectiveEnergyStorage
- All Implemented Interfaces:
net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.Tag>,net.neoforged.neoforge.energy.IEnergyStorage,ISerializableEnergyStorage
An energy storage implementation that provides forceful receive/extract methods.
-
Field Summary
Fields inherited from class net.neoforged.neoforge.energy.EnergyStorage
capacity, energy, maxExtract, maxReceive -
Constructor Summary
ConstructorsConstructorDescriptionProtectiveEnergyStorage(int capacity, int maxReceive, int maxExtract) An energy storage implementation that provides forceful receive/extract methods. -
Method Summary
Modifier and TypeMethodDescriptionintforceExtractEnergy(int energy, boolean simulate) Forcefully extract energy, ignoring if the energy storage can have energy extracted from or not.intforceReceiveEnergy(int energy, boolean simulate) Forcefully receive energy, ignoring if the energy storage can receive energy or not.Methods inherited from class top.girlkisser.lazuli.api.energy.LazuliEnergyStorage
extractEnergy, getExtractOnly, getReceiveOnly, onChange, receiveEnergyMethods inherited from class net.neoforged.neoforge.energy.EnergyStorage
canExtract, canReceive, deserializeNBT, getEnergyStored, getMaxEnergyStored, serializeNBTMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.neoforged.neoforge.energy.IEnergyStorage
canExtract, canReceive, getEnergyStored, getMaxEnergyStoredMethods inherited from interface net.neoforged.neoforge.common.util.INBTSerializable
deserializeNBT, serializeNBT
-
Constructor Details
-
ProtectiveEnergyStorage
public ProtectiveEnergyStorage(int capacity, int maxReceive, int maxExtract) An energy storage implementation that provides forceful receive/extract methods.- Parameters:
capacity- The capacity in RF/FE.maxReceive- The maximum amount of energy receivable per tick.maxExtract- The maximum amount of energy extractable per tick.
-
-
Method Details
-
forceReceiveEnergy
public int forceReceiveEnergy(int energy, boolean simulate) Forcefully receive energy, ignoring if the energy storage can receive energy or not.- Parameters:
energy- How much energy to add.simulate- If this action should be simulated or not.- Returns:
- The amount of energy received.
-
forceExtractEnergy
public int forceExtractEnergy(int energy, boolean simulate) Forcefully extract energy, ignoring if the energy storage can have energy extracted from or not.- Parameters:
energy- How much energy to add.simulate- If this action should be simulated or not.- Returns:
- The amount of energy received.
-