aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/tesla/TeslaCoverConnection.java17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/main/java/com/github/technus/tectech/mechanics/tesla/TeslaCoverConnection.java b/src/main/java/com/github/technus/tectech/mechanics/tesla/TeslaCoverConnection.java
index 99e0d75c1c..385ad8d74e 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/tesla/TeslaCoverConnection.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/tesla/TeslaCoverConnection.java
@@ -3,12 +3,17 @@ package com.github.technus.tectech.mechanics.tesla;
import com.github.technus.tectech.util.Vec3Impl;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import static com.github.technus.tectech.mechanics.tesla.ITeslaConnectable.TeslaUtil.teslaSimpleNodeSetAdd;
+import static com.github.technus.tectech.mechanics.tesla.ITeslaConnectable.TeslaUtil.teslaSimpleNodeSetRemove;
+
public class TeslaCoverConnection implements ITeslaConnectableSimple {
private final IGregTechTileEntity IGT;
+ private final Vec3Impl pos;
private final byte teslaReceptionCapability;
public TeslaCoverConnection(IGregTechTileEntity IGT, byte teslaReceptionCapability) {
this.IGT = IGT;
+ this.pos = new Vec3Impl(IGT);
this.teslaReceptionCapability = teslaReceptionCapability;
}
@@ -34,7 +39,7 @@ public class TeslaCoverConnection implements ITeslaConnectableSimple {
@Override
public Vec3Impl getTeslaPosition() {
- return new Vec3Impl(IGT);
+ return pos;
}
@Override
@@ -45,6 +50,14 @@ public class TeslaCoverConnection implements ITeslaConnectableSimple {
@Override
public boolean teslaInjectEnergy(long teslaVoltageInjected) {
//Same as in the microwave transmitters, this does not account for amp limits
- return IGT.injectEnergyUnits((byte) 1, teslaVoltageInjected, 1L) > 0L;
+ boolean output = false;
+
+ if (!IGT.isDead()){
+ output = IGT.injectEnergyUnits((byte) 1, teslaVoltageInjected, 1L) > 0L;
+ } else {
+ teslaSimpleNodeSetRemove(this);
+ }
+
+ return output;
}
}