mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-20 12:19:55 +00:00
#1409 Energy conduit and capacitor interaction bug
This commit is contained in:
1 parent
5a4598fe5d
commit
b885de7765
7 files changed
+49
-12
No files matched your search
@@ -147,7 +147,7 @@ public class NetworkPowerManager {
|
||||
}
|
||||
ReceptorEntry r = receptorIterator.next();
|
||||
IPowerInterface pp = r.powerInterface;
|
||||
if(pp != null) {
|
||||
if(pp != null) {
|
||||
int canOffer = Math.min(r.emmiter.getMaxEnergyExtracted(r.direction), available);
|
||||
int used = pp.recieveEnergy(r.direction.getOpposite(), canOffer);
|
||||
used = Math.max(0, used);
|
||||
@@ -287,7 +287,7 @@ public class NetworkPowerManager {
|
||||
con.onTick();
|
||||
energyStored += con.getEnergyStored();
|
||||
}
|
||||
energyStored = MathHelper.clamp_int(energyStored, 0, maxEnergyStored);
|
||||
energyStored = MathHelper.clamp_int(energyStored, 0, maxEnergyStored);
|
||||
}
|
||||
|
||||
public void receptorsChanged() {
|
||||
@@ -381,18 +381,21 @@ public class NetworkPowerManager {
|
||||
}
|
||||
|
||||
long canGet = 0;
|
||||
if(cb.isOutputEnabled(rec.direction.getOpposite())) {
|
||||
canGet = Math.min(cb.getEnergyStoredL(), cb.getMaxOutput());
|
||||
canGet = Math.min(canGet, rec.emmiter.getMaxEnergyRecieved(rec.direction));
|
||||
canExtract += canGet;
|
||||
}
|
||||
long canFill = 0;
|
||||
if(cb.isInputEnabled(rec.direction.getOpposite())) {
|
||||
canFill = Math.min(cb.getMaxEnergyStoredL() - cb.getEnergyStoredL(), cb.getMaxInput());
|
||||
canFill = Math.min(canFill, rec.emmiter.getMaxEnergyExtracted(rec.direction));
|
||||
this.canFill += canFill;
|
||||
if(cb.isNetworkControlledIo(rec.direction.getOpposite())) {
|
||||
if(cb.isOutputEnabled(rec.direction.getOpposite())) {
|
||||
canGet = Math.min(cb.getEnergyStoredL(), cb.getMaxOutput());
|
||||
canGet = Math.min(canGet, rec.emmiter.getMaxEnergyRecieved(rec.direction));
|
||||
canExtract += canGet;
|
||||
}
|
||||
|
||||
if(cb.isInputEnabled(rec.direction.getOpposite())) {
|
||||
canFill = Math.min(cb.getMaxEnergyStoredL() - cb.getEnergyStoredL(), cb.getMaxInput());
|
||||
canFill = Math.min(canFill, rec.emmiter.getMaxEnergyExtracted(rec.direction));
|
||||
this.canFill += canFill;
|
||||
}
|
||||
enteries.add(new CapBankSupplyEntry(cb, (int) canGet, (int) canFill, rec.emmiter, rec.direction));
|
||||
}
|
||||
enteries.add(new CapBankSupplyEntry(cb, (int) canGet, (int) canFill, rec.emmiter, rec.direction));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -437,6 +437,12 @@ public class TileCapBank extends TileEntityEio implements IInternalPowerHandler,
|
||||
return network.isInputEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNetworkControlledIo(ForgeDirection direction) {
|
||||
IoMode mode = getIoMode(direction);
|
||||
return mode == IoMode.NONE || mode == IoMode.PULL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCreative() {
|
||||
return getType().isCreative();
|
||||
|
||||
@@ -251,4 +251,9 @@ public class CapBankClientNetwork implements ICapBankNetwork {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNetworkControlledIo(ForgeDirection direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -554,4 +554,10 @@ public class CapBankNetwork implements ICapBankNetwork {
|
||||
return type.isCreative();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNetworkControlledIo(ForgeDirection direction) {
|
||||
//This is handled at the block level based on the IO mode
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -328,6 +328,12 @@ public class TileCapacitorBank extends TileEntityEio implements IInternalPowerHa
|
||||
return mode == IoMode.PULL || mode == IoMode.NONE && isInputEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNetworkControlledIo(ForgeDirection direction) {
|
||||
IoMode mode = getIoMode(direction);
|
||||
return mode == IoMode.NONE || mode == IoMode.PULL;
|
||||
}
|
||||
|
||||
private boolean transmitEnergy() {
|
||||
|
||||
if(getEnergyStored() <= 0) {
|
||||
|
||||
@@ -10,6 +10,16 @@ public interface IPowerStorage {
|
||||
|
||||
long getMaxEnergyStoredL();
|
||||
|
||||
/**
|
||||
* If false this connection will be treated the same a regular powered block.
|
||||
* No power will be drawn over the connection and it will not be used to
|
||||
* balance capacitor bank levels
|
||||
*
|
||||
* @param direction
|
||||
* @return
|
||||
*/
|
||||
boolean isNetworkControlledIo(ForgeDirection direction);
|
||||
|
||||
boolean isOutputEnabled(ForgeDirection direction);
|
||||
|
||||
boolean isInputEnabled(ForgeDirection direction);
|
||||
|
||||
Reference in new issue
Block a user