diff options
author | Glease <4586901+Glease@users.noreply.github.com> | 2022-03-12 16:23:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-12 09:23:06 +0100 |
commit | bcf871bf44f5dd123b4ad9fa4cab497437b9298c (patch) | |
tree | e3f210ad841fa4e98edabc49b28c235b36d0a519 /src/main/java/gtPlusPlus/xmod/gregtech/api/gui/SyncedLong.java | |
parent | 58e94b7daa0d73e71c97eb78325064bfa91f10f8 (diff) | |
download | GT5-Unofficial-bcf871bf44f5dd123b4ad9fa4cab497437b9298c.tar.gz GT5-Unofficial-bcf871bf44f5dd123b4ad9fa4cab497437b9298c.tar.bz2 GT5-Unofficial-bcf871bf44f5dd123b4ad9fa4cab497437b9298c.zip |
fix pss gui & make average IO actually an average (#157)
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/api/gui/SyncedLong.java')
-rw-r--r-- | src/main/java/gtPlusPlus/xmod/gregtech/api/gui/SyncedLong.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/SyncedLong.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/SyncedLong.java index 4430631e07..4214d32469 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/SyncedLong.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/SyncedLong.java @@ -24,19 +24,24 @@ class SyncedLong { } public void setValue(long value) { - if (this.value != value) + if (this.value != value) { dirty = true; - this.value = value; + this.value = value; + } } void detectAndSendChanges(SendChanges func, int timer) { if (dirty || (timer & 0xff) == 0) { for (int i = 0; i < 4; i++) { - func.sendProgressBarUpdate(index + i, (int) ((value >> (16 * i)) & Short.MIN_VALUE)); + func.sendProgressBarUpdate(index + i, (int) ((value >> (16 * i)) & 0xffff)); } dirty = false; } } + + private long getPiece(int index) { + return ((long) pieces[index]) & 0xffff; + } boolean updateProgressBar(int short1, int short2) { int offset = short1 - index; @@ -44,7 +49,7 @@ class SyncedLong { pieces[offset] = (short) short2; received |= (1 << offset); if (received == 0b1111) { - value = ((long) pieces[0]) | ((long) pieces[1] << 16) | ((long) pieces[2] << 32) | ((long) pieces[3] << 48); + value = (getPiece(0)) | (getPiece(1) << 16) | (getPiece(2) << 32) | (getPiece(3) << 48); received = 0; } return true; |