Fixed Energy Cube/Generator UE energy outputting
This commit is contained in:
parent
773f40717c
commit
9e51cdd4bc
3 changed files with 39 additions and 3 deletions
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue