public class TileEnergyHandler extends net.minecraft.tileentity.TileEntity implements IEnergyHandler
IEnergyHandler
. Use/extend this or implement your own.Modifier and Type | Field and Description |
---|---|
protected EnergyStorage |
storage |
Constructor and Description |
---|
TileEnergyHandler() |
Modifier and Type | Method and Description |
---|---|
boolean |
canConnectEnergy(net.minecraftforge.common.util.ForgeDirection from)
Returns TRUE if the TileEntity can connect on a given side.
|
int |
extractEnergy(net.minecraftforge.common.util.ForgeDirection from,
int maxExtract,
boolean simulate)
Remove energy from an IEnergyProvider, internal distribution is left entirely to the IEnergyProvider.
|
int |
getEnergyStored(net.minecraftforge.common.util.ForgeDirection from)
Returns the amount of energy currently stored.
|
int |
getMaxEnergyStored(net.minecraftforge.common.util.ForgeDirection from)
Returns the maximum amount of energy that can be stored.
|
void |
readFromNBT(net.minecraft.nbt.NBTTagCompound nbt) |
int |
receiveEnergy(net.minecraftforge.common.util.ForgeDirection from,
int maxReceive,
boolean simulate)
Add energy to an IEnergyReceiver, internal distribution is left entirely to the IEnergyReceiver.
|
void |
writeToNBT(net.minecraft.nbt.NBTTagCompound nbt) |
addMapping, canUpdate, createAndLoadEntity, func_145828_a, getBlockMetadata, getBlockType, getDescriptionPacket, getDistanceFrom, getMaxRenderDistanceSquared, getRenderBoundingBox, getWorldObj, hasWorldObj, invalidate, isInvalid, markDirty, onChunkUnload, onDataPacket, receiveClientEvent, setWorldObj, shouldRefresh, shouldRenderInPass, updateContainingBlockInfo, updateEntity, validate
protected EnergyStorage storage
public void readFromNBT(net.minecraft.nbt.NBTTagCompound nbt)
readFromNBT
in class net.minecraft.tileentity.TileEntity
public void writeToNBT(net.minecraft.nbt.NBTTagCompound nbt)
writeToNBT
in class net.minecraft.tileentity.TileEntity
public boolean canConnectEnergy(net.minecraftforge.common.util.ForgeDirection from)
IEnergyConnection
canConnectEnergy
in interface IEnergyConnection
public int receiveEnergy(net.minecraftforge.common.util.ForgeDirection from, int maxReceive, boolean simulate)
IEnergyHandler
receiveEnergy
in interface IEnergyHandler
receiveEnergy
in interface IEnergyReceiver
from
- Orientation the energy is received from.maxReceive
- Maximum amount of energy to receive.simulate
- If TRUE, the charge will only be simulated.public int extractEnergy(net.minecraftforge.common.util.ForgeDirection from, int maxExtract, boolean simulate)
IEnergyHandler
extractEnergy
in interface IEnergyHandler
extractEnergy
in interface IEnergyProvider
from
- Orientation the energy is extracted from.maxExtract
- Maximum amount of energy to extract.simulate
- If TRUE, the extraction will only be simulated.public int getEnergyStored(net.minecraftforge.common.util.ForgeDirection from)
IEnergyHandler
getEnergyStored
in interface IEnergyHandler
getEnergyStored
in interface IEnergyProvider
getEnergyStored
in interface IEnergyReceiver
public int getMaxEnergyStored(net.minecraftforge.common.util.ForgeDirection from)
IEnergyHandler
getMaxEnergyStored
in interface IEnergyHandler
getMaxEnergyStored
in interface IEnergyProvider
getMaxEnergyStored
in interface IEnergyReceiver