float toBalance = 0;
float maxToBalance = 0;
for (ReceptorEntry rec : storageReceptors) {
TileCapacitorBank cb = (TileCapacitorBank) rec.powerInterface.getDelegate();
boolean processed = capBanks.contains(cb.getController());
if(!processed) {
stored += cb.getEnergyStored();
maxCap += cb.getMaxEnergyStored();
capBanks.add(cb.getController());
}
if(rec.emmiter.getConnectionMode(rec.direction) == ConnectionMode.IN_OUT) {
toBalance += cb.getEnergyStored();
maxToBalance += cb.getMaxEnergyStored();
}
int canGet = 0;
if(cb.isOutputEnabled(rec.direction.getOpposite())) {
canGet = Math.min(cb.getEnergyStored(), cb.getMaxOutput());
canGet = Math.min(canGet, rec.emmiter.getMaxEnergyRecieved(rec.direction));
canExtract += canGet;
}
int canFill = 0;
if(cb.isInputEnabled(rec.direction.getOpposite())) {
canFill = Math.min(cb.getMaxEnergyStored() - cb.getEnergyStored(), cb.getMaxInput());
canFill = Math.min(canFill, rec.emmiter.getMaxEnergyExtracted(rec.direction));
this.canFill += canFill;
}
enteries.add(new CapBankSupplyEntry(cb, canGet, canFill, rec.emmiter, rec.direction));