public final class PowerHandler
extends java.lang.Object
IPowerReceptor,
IPowerEmitter| Modifier and Type | Class and Description |
|---|---|
static class |
PowerHandler.PerditionCalculator
Extend this class to create custom Perdition algorithms (its not final).
|
class |
PowerHandler.PowerReceiver |
static class |
PowerHandler.Type |
| Modifier and Type | Field and Description |
|---|---|
static PowerHandler.PerditionCalculator |
DEFAULT_PERDITION |
int[] |
powerSources |
IPowerReceptor |
receptor |
static double |
ROLLING_AVERAGE_DENOMINATOR |
static double |
ROLLING_AVERAGE_NUMERATOR |
static double |
ROLLING_AVERAGE_WEIGHT |
| Constructor and Description |
|---|
PowerHandler(IPowerReceptor receptor,
PowerHandler.Type type) |
| Modifier and Type | Method and Description |
|---|---|
double |
addEnergy(double quantity) |
void |
configure(double minEnergyReceived,
double maxEnergyReceived,
double activationEnergy,
double maxStoredEnergy)
Setup your PowerHandler's settings.
|
void |
configurePowerPerdition(int powerLoss,
int powerLossRegularity)
Allows you define perdition in terms of loss/ticks.
|
double |
getActivationEnergy() |
double |
getEnergyStored() |
double |
getMaxEnergyReceived() |
double |
getMaxEnergyStored() |
double |
getMinEnergyReceived() |
PowerHandler.PerditionCalculator |
getPerdition() |
PowerHandler.PowerReceiver |
getPowerReceiver() |
boolean |
isPowerSource(net.minecraftforge.common.util.ForgeDirection from) |
void |
readFromNBT(net.minecraft.nbt.NBTTagCompound data) |
void |
readFromNBT(net.minecraft.nbt.NBTTagCompound data,
java.lang.String tag) |
void |
setEnergy(double quantity) |
void |
setPerdition(PowerHandler.PerditionCalculator perdition)
Allows you to define a new PerditionCalculator class to handler perdition
calculations.
|
void |
update()
Ticks the power handler.
|
double |
useEnergy(double min,
double max,
boolean doUse)
Extract energy from the PowerHandler.
|
void |
writeToNBT(net.minecraft.nbt.NBTTagCompound data) |
void |
writeToNBT(net.minecraft.nbt.NBTTagCompound data,
java.lang.String tag) |
public static final PowerHandler.PerditionCalculator DEFAULT_PERDITION
public static final double ROLLING_AVERAGE_WEIGHT
public static final double ROLLING_AVERAGE_NUMERATOR
public static final double ROLLING_AVERAGE_DENOMINATOR
public final int[] powerSources
public final IPowerReceptor receptor
public PowerHandler(IPowerReceptor receptor, PowerHandler.Type type)
public PowerHandler.PowerReceiver getPowerReceiver()
public double getMinEnergyReceived()
public double getMaxEnergyReceived()
public double getMaxEnergyStored()
public double getActivationEnergy()
public double getEnergyStored()
public void configure(double minEnergyReceived,
double maxEnergyReceived,
double activationEnergy,
double maxStoredEnergy)
minEnergyReceived - This is the minimum about of power that will be
accepted by the PowerHandler. This should generally be greater than the
activationEnergy if you plan to use the doWork() callback. Anything
greater than 1 will prevent Redstone Engines from powering this Provider.maxEnergyReceived - The maximum amount of power accepted by the
PowerHandler. This should generally be less than 500. Too low and larger
engines will overheat while trying to power the machine. Too high, and
the engines will never warm up. Greater values also place greater strain
on the power net.activationEnergy - If the stored energy is greater than this value,
the doWork() callback is called (once per tick).maxStoredEnergy - The maximum amount of power this PowerHandler can
store. Values tend to range between 100 and 5000. With 1000 and 1500
being common.public void configurePowerPerdition(int powerLoss,
int powerLossRegularity)
powerLoss - powerLossRegularity - PowerHandler.PerditionCalculatorpublic void setPerdition(PowerHandler.PerditionCalculator perdition)
perdition - public PowerHandler.PerditionCalculator getPerdition()
public void update()
public double useEnergy(double min,
double max,
boolean doUse)
min - max - doUse - public void readFromNBT(net.minecraft.nbt.NBTTagCompound data)
public void readFromNBT(net.minecraft.nbt.NBTTagCompound data,
java.lang.String tag)
public void writeToNBT(net.minecraft.nbt.NBTTagCompound data)
public void writeToNBT(net.minecraft.nbt.NBTTagCompound data,
java.lang.String tag)
public double addEnergy(double quantity)
public void setEnergy(double quantity)
public boolean isPowerSource(net.minecraftforge.common.util.ForgeDirection from)