Fixed Energy Cube/Generator UE energy outputting

This commit is contained in:
Aidan Brady 2013-08-01 11:23:07 -04:00
parent 773f40717c
commit 9e51cdd4bc
3 changed files with 39 additions and 3 deletions

View file

@ -206,7 +206,7 @@ public abstract class TileEntityElectricBlock extends TileEntityContainerBlock i
{
if(getConsumingSides().contains(direction))
{
return (float)((getMaxEnergy()-getEnergy())*Mekanism.TO_UE);
return getMaxEnergyStored()-getEnergyStored();
}
return 0;

View file

@ -164,7 +164,25 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IEn
@Override
public float getProvide(ForgeDirection direction)
{
return getOutputtingSides().contains(direction) ? (float)Math.min(getMaxEnergy()-getEnergy(), tier.OUTPUT) : 0;
return getOutputtingSides().contains(direction) ? Math.min(getEnergyStored(), (float)(tier.OUTPUT*Mekanism.TO_UE)) : 0;
}
@Override
public ElectricityPack provideElectricity(ForgeDirection from, ElectricityPack request, boolean doProvide)
{
if(getOutputtingSides().contains(from))
{
double toSend = Math.min(getEnergy(), Math.min(tier.OUTPUT, request.getWatts()*Mekanism.FROM_UE));
if(doProvide)
{
setEnergy(getEnergy() - toSend);
}
return ElectricityPack.getFromWatts((float)(toSend*Mekanism.TO_UE), getVoltage());
}
return new ElectricityPack();
}
@Override

View file

@ -158,7 +158,25 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem
@Override
public float getProvide(ForgeDirection direction)
{
return getOutputtingSides().contains(direction) ? (float)Math.min(getMaxEnergy()-getEnergy(), output) : 0;
return getOutputtingSides().contains(direction) ? Math.min(getEnergyStored(), (float)(output*Mekanism.TO_UE)) : 0;
}
@Override
public ElectricityPack provideElectricity(ForgeDirection from, ElectricityPack request, boolean doProvide)
{
if(getOutputtingSides().contains(from))
{
double toSend = Math.min(getEnergy(), Math.min(output, request.getWatts()*Mekanism.FROM_UE));
if(doProvide)
{
setEnergy(getEnergy() - toSend);
}
return ElectricityPack.getFromWatts((float)(toSend*Mekanism.TO_UE), getVoltage());
}
return new ElectricityPack();
}
@Override