aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/graphs/paths
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/api/graphs/paths')
-rw-r--r--src/main/java/gregtech/api/graphs/paths/NodePath.java15
-rw-r--r--src/main/java/gregtech/api/graphs/paths/PowerNodePath.java3
2 files changed, 16 insertions, 2 deletions
diff --git a/src/main/java/gregtech/api/graphs/paths/NodePath.java b/src/main/java/gregtech/api/graphs/paths/NodePath.java
index bdf82ec5b0..efdcd1aecb 100644
--- a/src/main/java/gregtech/api/graphs/paths/NodePath.java
+++ b/src/main/java/gregtech/api/graphs/paths/NodePath.java
@@ -1,11 +1,13 @@
package gregtech.api.graphs.paths;
+import gregtech.api.graphs.Lock;
import gregtech.api.metatileentity.BaseMetaPipeEntity;
import gregtech.api.metatileentity.MetaPipeEntity;
//to contain all info about the path between nodes
public class NodePath {
protected MetaPipeEntity[] mPipes;
+ public Lock lock;
public NodePath(MetaPipeEntity[] aCables) {
this.mPipes = aCables;
@@ -20,11 +22,20 @@ public class NodePath {
}
public void clearPath() {
- for (int i = 0; i < mPipes.length; i++) {
- BaseMetaPipeEntity tBasePipe = (BaseMetaPipeEntity) mPipes[i].getBaseMetaTileEntity();
+ for (MetaPipeEntity mPipe : mPipes) {
+ BaseMetaPipeEntity tBasePipe = (BaseMetaPipeEntity) mPipe.getBaseMetaTileEntity();
if (tBasePipe != null) {
tBasePipe.setNodePath(null);
}
}
}
+
+ public void reloadLocks() {
+ for (MetaPipeEntity pipe : mPipes) {
+ BaseMetaPipeEntity basePipe = (BaseMetaPipeEntity) pipe.getBaseMetaTileEntity();
+ if (basePipe != null) {
+ basePipe.reloadLocks();
+ }
+ }
+ }
}
diff --git a/src/main/java/gregtech/api/graphs/paths/PowerNodePath.java b/src/main/java/gregtech/api/graphs/paths/PowerNodePath.java
index 72b2edb334..d18d6bcdd3 100644
--- a/src/main/java/gregtech/api/graphs/paths/PowerNodePath.java
+++ b/src/main/java/gregtech/api/graphs/paths/PowerNodePath.java
@@ -37,6 +37,7 @@ public class PowerNodePath extends NodePath {
this.mVoltage = aVoltage;
}
if (aVoltage > mMaxVoltage) {
+ lock.addTileEntity(null);
for (MetaPipeEntity tCable : mPipes) {
if (((GT_MetaPipeEntity_Cable) tCable).mVoltage < this.mVoltage) {
BaseMetaPipeEntity tBaseCable = (BaseMetaPipeEntity) tCable.getBaseMetaTileEntity();
@@ -51,6 +52,7 @@ public class PowerNodePath extends NodePath {
private void reset(int aTimePassed) {
if (aTimePassed < 0 || aTimePassed > 100) {
mAmps = 0;
+ return;
}
mAmps = Math.max(0, mAmps - (mMaxAmps * aTimePassed));
}
@@ -58,6 +60,7 @@ public class PowerNodePath extends NodePath {
public void addAmps(long aAmps) {
this.mAmps += aAmps;
if (this.mAmps > mMaxAmps * 40) {
+ lock.addTileEntity(null);
for (MetaPipeEntity tCable : mPipes) {
if (((GT_MetaPipeEntity_Cable) tCable).mAmperage * 40 < this.mAmps) {
BaseMetaPipeEntity tBaseCable = (BaseMetaPipeEntity) tCable.getBaseMetaTileEntity();