public class EnergyContainingItem
extends java.lang.Object
implements net.minecraftforge.energy.IEnergyStorage, net.minecraftforge.common.capabilities.ICapabilityProvider
NeoTech is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License: http://creativecommons.org/licenses/by-nc-sa/4.0/
Constructor and Description |
---|
EnergyContainingItem(net.minecraft.item.ItemStack stack,
int size)
Simplest constructor of EnergyBank
|
Modifier and Type | Method and Description |
---|---|
boolean |
canExtract()
Returns if this storage can have energy extracted.
|
boolean |
canReceive()
Used to determine if this storage can receive energy.
|
protected void |
checkStackTag()
Makes sure we always have a valid tag
|
int |
extractEnergy(int maxExtract,
boolean simulate)
Removes energy from the storage.
|
<T> net.minecraftforge.common.util.LazyOptional<T> |
getCapability(net.minecraftforge.common.capabilities.Capability<T> capability,
net.minecraft.util.Direction facing)
Retrieves the handler for the capability requested on the specific side.
|
int |
getEnergyStored()
Returns the amount of energy currently stored.
|
int |
getMaxEnergyStored()
Returns the maximum amount of energy that can be stored.
|
int |
receiveEnergy(int maxReceive,
boolean simulate)
Adds energy to the storage.
|
public EnergyContainingItem(net.minecraft.item.ItemStack stack, int size)
size
- The max stored, also sets max in and outprotected void checkStackTag()
public int receiveEnergy(int maxReceive, boolean simulate)
receiveEnergy
in interface net.minecraftforge.energy.IEnergyStorage
maxReceive
- Maximum amount of energy to be inserted.simulate
- If TRUE, the insertion will only be simulated.public int extractEnergy(int maxExtract, boolean simulate)
extractEnergy
in interface net.minecraftforge.energy.IEnergyStorage
maxExtract
- Maximum amount of energy to be extracted.simulate
- If TRUE, the extraction will only be simulated.public int getEnergyStored()
getEnergyStored
in interface net.minecraftforge.energy.IEnergyStorage
public int getMaxEnergyStored()
getMaxEnergyStored
in interface net.minecraftforge.energy.IEnergyStorage
public boolean canExtract()
canExtract
in interface net.minecraftforge.energy.IEnergyStorage
public boolean canReceive()
canReceive
in interface net.minecraftforge.energy.IEnergyStorage
@Nonnull public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(@Nonnull net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable net.minecraft.util.Direction facing)
getCapability
in interface net.minecraftforge.common.capabilities.ICapabilityProvider
capability
- The capability to checkfacing
- The Side to check from:
CAN BE NULL. Null is defined to represent 'internal' or 'self'