aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/threads
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/api/threads')
-rw-r--r--src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java b/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java
index 3bac8866c3..cefbb0bc8d 100644
--- a/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java
+++ b/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java
@@ -68,6 +68,10 @@ public class GT_Runnable_MachineBlockUpdate implements Runnable {
GT_Runnable_MachineBlockUpdate.setmWorld(aWorld);
GT_Runnable_MachineBlockUpdate.resetVisited();
GT_Runnable_MachineBlockUpdate.setAllowedToRun(true);
+ synchronized (GT_Runnable_MachineBlockUpdate.INSTANCETHREAD) {
+ if (GT_Runnable_MachineBlockUpdate.INSTANCETHREAD.getState() == Thread.State.WAITING)
+ GT_Runnable_MachineBlockUpdate.INSTANCETHREAD.notify();
+ }
}
/**
@@ -161,8 +165,17 @@ public class GT_Runnable_MachineBlockUpdate implements Runnable {
//DO NOT USE OPTIONALS HERE!
synchronized (toUpdate) {
Coordinates coordinates = toUpdate.poll();
- if (coordinates != null)
+ if (coordinates != null) {
coordinates.update();
+ } else {
+ synchronized(INSTANCETHREAD) {
+ try {
+ INSTANCETHREAD.wait();
+ } catch (InterruptedException ignored) {
+ return;
+ }
+ }
+ }
}
}
}