if (CartTools.cartVelocityIsLessThan(cart, STOP_VELOCITY))
setPowered(true);
return;
}
IEnergyTransfer energyCart = (IEnergyTransfer) cart;
if (!energyCart.canInjectEnergy() || energyCart.getTier() > getTier()) {
if (CartTools.cartVelocityIsLessThan(cart, STOP_VELOCITY))
setPowered(true);
return;
}
if (isPaused())
return;
if (energy > 0 && energyCart.getEnergy() < energyCart.getCapacity()) {
double usage = (int) (energyCart.getTransferLimit() * Math.pow(1.5, overclockerUpgrades));
double injection = (int) (energyCart.getTransferLimit() * Math.pow(1.3, overclockerUpgrades));
if (usage > energy) {
double ratio = (double) energy / (double) usage;
usage = energy;
injection = (int) (injection * ratio);
}
transferRate = (int) injection;
double extra = energyCart.injectEnergy(this, injection, getTier(), true, false, false);
energy -= usage - extra;
transferedEnergy = extra != injection;
}
if (!transferedEnergy && !isPowered() && CartTools.cartVelocityIsLessThan(cart, STOP_VELOCITY))
if (!waitTillFull && energyCart.getEnergy() > 0)
setPowered(true);
else if (!waitIfEmpty && !waitTillFull && energyCart.getEnergy() == 0)
setPowered(true);
else if (energyCart.getEnergy() >= energyCart.getCapacity())
setPowered(true);
}