aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2019-04-08 14:23:59 +1000
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2019-04-08 14:23:59 +1000
commit079256e5324a6f72a08a77878685302f7b24dc58 (patch)
treedacd3bb699778faf34c82578e28cb0455952ef75
parent60b9e2b720abca8908a1ac2a7f5767af08bccaf9 (diff)
downloadGT5-Unofficial-079256e5324a6f72a08a77878685302f7b24dc58.tar.gz
GT5-Unofficial-079256e5324a6f72a08a77878685302f7b24dc58.tar.bz2
GT5-Unofficial-079256e5324a6f72a08a77878685302f7b24dc58.zip
$ Fixed another small infinite loop. (Redstone is fucking complicated, damn you Notch)
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/general/redstone/TileEntityRedstoneHandler.java18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/Java/gtPlusPlus/core/tileentities/general/redstone/TileEntityRedstoneHandler.java b/src/Java/gtPlusPlus/core/tileentities/general/redstone/TileEntityRedstoneHandler.java
index fa2597eae9..eda0c65e46 100644
--- a/src/Java/gtPlusPlus/core/tileentities/general/redstone/TileEntityRedstoneHandler.java
+++ b/src/Java/gtPlusPlus/core/tileentities/general/redstone/TileEntityRedstoneHandler.java
@@ -20,6 +20,7 @@ public abstract class TileEntityRedstoneHandler extends TileEntity implements IT
private BlockPos mTilePos;
private boolean mRequiresUpdate = false;
private Long mStartTime;
+ private Byte mRedstoneLevel;
public boolean mLightMode = false;
public float mLightValue = 0;
@@ -66,6 +67,7 @@ public abstract class TileEntityRedstoneHandler extends TileEntity implements IT
mInvName = aNBT.getString("mInvName");
mLightValue = aNBT.getFloat("mLightValue");
mLightMode = aNBT.getBoolean("mLightMode");
+ mRedstoneLevel = aNBT.getByte("mRedstoneLevel");
super.readFromNBT(aNBT);
}
@@ -76,6 +78,7 @@ public abstract class TileEntityRedstoneHandler extends TileEntity implements IT
aNBT.setString("mInvName", mInvName);
aNBT.setFloat("mLightValue", getLightBrightness());
aNBT.setBoolean("mLightMode", isLight());
+ aNBT.setByte("mRedstoneLevel", mRedstoneLevel);
super.writeToNBT(aNBT);
}
@@ -272,15 +275,18 @@ public abstract class TileEntityRedstoneHandler extends TileEntity implements IT
* @return
*/
public int getRedstoneLevel() {
- if (mTilePos == null) {
+ if (mTilePos == null || mRedstoneLevel == null) {
return 0;
}
- if (canSupplyRedstoneSignal()) {
- int aInputPower = getInputPowerLevel();
- if (aInputPower > 0) {
- return aInputPower;
+ else {
+ if (canSupplyRedstoneSignal()) {
+ if (this.hasUpdatedRecently()) {
+ int aInputPower = getInputPowerLevel();
+ mRedstoneLevel = (byte) ((aInputPower >= 0 && aInputPower <= 127) ? aInputPower : 0);
+ }
+ return mRedstoneLevel;
}
- }
+ }
return 0;
}