blob: 219e503a990b44c240ca919d63735ea9afd0a8c8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
package gtPlusPlus.xmod.gregtech.api.gui;
import java.util.ArrayList;
import java.util.List;
/**
* A manager for managing synchronized variables. Handles large data type splitting and merging for you <b>correctly</b>.
*
* @author glee8e
*/
class SyncedValueManager {
private int offset;
private final List<SyncedLong> longs = new ArrayList<>();
SyncedValueManager(int offset) {
this.offset = offset;
}
public SyncedLong allocateLong() {
SyncedLong ret = new SyncedLong(offset);
offset += 4;
longs.add(ret);
return ret;
}
public void detectAndSendChanges(SendChanges func, int timer) {
for (SyncedLong val : longs) {
val.detectAndSendChanges(func, timer);
}
}
public void updateProgressBar(int short1, int short2) {
for (SyncedLong val : longs) {
if (val.updateProgressBar(short1, short2)) return;
}
}
@FunctionalInterface
public interface SendChanges {
void sendProgressBarUpdate(int short1, int short2);
}
}
|