aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/gui/GT_ContainerMetaTile_Machine.java
diff options
context:
space:
mode:
authormiozune <miozune@gmail.com>2022-08-02 17:34:54 +0900
committerGitHub <noreply@github.com>2022-08-02 10:34:54 +0200
commit50a5f9f5df5fc7d3690d9c8b3bfff67e69f4df73 (patch)
treefed6ac3684989ef619876e99159e5467caece595 /src/main/java/gregtech/api/gui/GT_ContainerMetaTile_Machine.java
parent89bf9ba2b6fe2e7c8217f78389318ec5140be0c5 (diff)
downloadGT5-Unofficial-50a5f9f5df5fc7d3690d9c8b3bfff67e69f4df73.tar.gz
GT5-Unofficial-50a5f9f5df5fc7d3690d9c8b3bfff67e69f4df73.tar.bz2
GT5-Unofficial-50a5f9f5df5fc7d3690d9c8b3bfff67e69f4df73.zip
Fusion fixes (#1181)
* Allow storing `long` energy * Fix hardcoded voltage limit for searching recipe * Fix reactor might run without consuming energy * Fix weird charging rate limit
Diffstat (limited to 'src/main/java/gregtech/api/gui/GT_ContainerMetaTile_Machine.java')
-rw-r--r--src/main/java/gregtech/api/gui/GT_ContainerMetaTile_Machine.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/main/java/gregtech/api/gui/GT_ContainerMetaTile_Machine.java b/src/main/java/gregtech/api/gui/GT_ContainerMetaTile_Machine.java
index a6a6064976..c0c2863521 100644
--- a/src/main/java/gregtech/api/gui/GT_ContainerMetaTile_Machine.java
+++ b/src/main/java/gregtech/api/gui/GT_ContainerMetaTile_Machine.java
@@ -26,6 +26,8 @@ public class GT_ContainerMetaTile_Machine extends GT_Container {
mInput = 0,
mID = 0,
mDisplayErrorCode = 0;
+ public long mEnergyLong = 0,
+ mStorageLong = 0;
private int oActive = 0,
oMaxProgressTime = 0,
oProgressTime = 0,
@@ -37,6 +39,8 @@ public class GT_ContainerMetaTile_Machine extends GT_Container {
oInput = 0,
oID = 0,
oDisplayErrorCode = 0;
+ private long oEnergyLong = 0,
+ oStorageLong = 0;
protected int mTimer = 0;
@@ -75,7 +79,9 @@ public class GT_ContainerMetaTile_Machine extends GT_Container {
if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null)
return;
mStorage = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getEUCapacity());
+ mStorageLong = mTileEntity.getEUCapacity();
mEnergy = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getStoredEU());
+ mEnergyLong = mTileEntity.getStoredEU();
mSteamStorage = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getSteamCapacity());
mSteam = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getStoredSteam());
mOutput = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getOutputVoltage());
@@ -127,6 +133,14 @@ public class GT_ContainerMetaTile_Machine extends GT_Container {
player.sendProgressBarUpdate(this, 19, mSteamStorage & 65535);
player.sendProgressBarUpdate(this, 20, mSteamStorage >>> 16);
}
+ if (mTimer % 500 == 10 || oEnergyLong != mEnergyLong) {
+ player.sendProgressBarUpdate(this, 21, (int) mEnergyLong);
+ player.sendProgressBarUpdate(this, 22, (int) (mEnergyLong >>> 32));
+ }
+ if (mTimer % 500 == 10 || oStorageLong != mStorageLong) {
+ player.sendProgressBarUpdate(this, 23, (int) mStorageLong);
+ player.sendProgressBarUpdate(this, 24, (int) (mStorageLong >>> 32));
+ }
}
oID = mID;
@@ -198,6 +212,18 @@ public class GT_ContainerMetaTile_Machine extends GT_Container {
case 20:
mSteamStorage = mSteamStorage & 0x0000ffff | value << 16;
break;
+ case 21:
+ mEnergyLong = mEnergyLong & 0xffffffff00000000L | value & 0x00000000ffffffffL;
+ break;
+ case 22:
+ mEnergyLong = mEnergyLong & 0x00000000ffffffffL | (long) value << 32;
+ break;
+ case 23:
+ mStorageLong = mStorageLong & 0xffffffff00000000L | value & 0x00000000ffffffffL;
+ break;
+ case 24:
+ mStorageLong = mStorageLong & 0x00000000ffffffffL | (long) value << 32;
+ break;
}
}