This commit is contained in:
parent
12b05275f2
commit
1760113cd4
|
@ -64,9 +64,7 @@ class PoweredItemCapabilities implements ICapabilityProvider, IEnergyStorage
|
||||||
@Override
|
@Override
|
||||||
public boolean hasCapability( Capability<?> capability, @Nullable EnumFacing facing )
|
public boolean hasCapability( Capability<?> capability, @Nullable EnumFacing facing )
|
||||||
{
|
{
|
||||||
return capability == CapabilityEnergy.ENERGY
|
return capability == CapabilityEnergy.ENERGY || capability == Capabilities.TESLA_CONSUMER || capability == Capabilities.TESLA_HOLDER;
|
||||||
|| capability == Capabilities.TESLA_CONSUMER
|
|
||||||
|| capability == Capabilities.TESLA_HOLDER;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings( "unchecked" )
|
@SuppressWarnings( "unchecked" )
|
||||||
|
@ -87,10 +85,10 @@ class PoweredItemCapabilities implements ICapabilityProvider, IEnergyStorage
|
||||||
@Override
|
@Override
|
||||||
public int receiveEnergy( int maxReceive, boolean simulate )
|
public int receiveEnergy( int maxReceive, boolean simulate )
|
||||||
{
|
{
|
||||||
|
|
||||||
if( simulate )
|
if( simulate )
|
||||||
{
|
{
|
||||||
final int required = (int) PowerUnits.AE.convertTo( PowerUnits.RF, item.getAEMaxPower( is ) - item.getAECurrentPower( is ) );
|
final int required = (int) PowerUnits.AE.convertTo( PowerUnits.RF, item.getAEMaxPower( is ) - item.getAECurrentPower( is ) );
|
||||||
|
|
||||||
if( maxReceive < required )
|
if( maxReceive < required )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -100,7 +98,7 @@ class PoweredItemCapabilities implements ICapabilityProvider, IEnergyStorage
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
final double powerRemainder = item.injectAEPower( is, PowerUnits.RF.convertTo( PowerUnits.AE, maxReceive ) );
|
final double powerRemainder = item.injectAEPower( is, PowerUnits.RF.convertTo( PowerUnits.AE, maxReceive ) );
|
||||||
return (int) PowerUnits.AE.convertTo( PowerUnits.RF, powerRemainder );
|
return maxReceive - (int) PowerUnits.AE.convertTo( PowerUnits.RF, powerRemainder );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue