blob: 3f50b6b4eba7382c7c9b2946539949a28712ae89 [file] [log] [blame] [raw]
package mekanism.common.capabilities;
import mekanism.api.energy.IStrictEnergyAcceptor;
import net.minecraft.util.EnumFacing;
/**
* Created by ben on 30/04/16.
*/
public class StrictEnergyAcceptor extends StrictEnergyStorage implements IStrictEnergyAcceptor
{
public StrictEnergyAcceptor(double capacity)
{
super(capacity);
}
@Override
public double transferEnergyToAcceptor(EnumFacing side, double amount)
{
double used = Math.min(amount, Math.max(0, getMaxEnergy() - getEnergy()));
setEnergy(getEnergy() + used);
return used;
}
@Override
public boolean canReceiveEnergy(EnumFacing side)
{
return true;
}
}