From 42404c531dbf5ff6bbf78f10d5411b7b6ff5de13 Mon Sep 17 00:00:00 2001
From: LexManos <LexManos@gmail.com>
Date: Tue, 3 May 2016 23:19:40 -0700
Subject: [PATCH] Slightly better practice because wait can be randomly
 interupted.

---
 .../common/chunkio/ChunkIOExecutor.java       | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/main/java/net/minecraftforge/common/chunkio/ChunkIOExecutor.java b/src/main/java/net/minecraftforge/common/chunkio/ChunkIOExecutor.java
index 3b8fccbf2..0e46a9fd2 100644
--- a/src/main/java/net/minecraftforge/common/chunkio/ChunkIOExecutor.java
+++ b/src/main/java/net/minecraftforge/common/chunkio/ChunkIOExecutor.java
@@ -45,17 +45,20 @@ public class ChunkIOExecutor
         ChunkIOProvider task = tasks.get(key);
         if (task != null)
         {
-            if (!pool.remove(task) && !task.runFinished()) // If it wasn't in the pool, and run hasn't finished, then wait for the async thread.
+            if (!pool.remove(task)) // If it wasn't in the pool, and run hasn't finished, then wait for the async thread.
             {
-                synchronized(task)
+                while (!task.runFinished())
                 {
-                    try
+                    synchronized(task)
                     {
-                        task.wait();
-                    }
-                    catch (InterruptedException e)
-                    {
-                        e.printStackTrace(); // Something happened? Log it?
+                        try
+                        {
+                            task.wait();
+                        }
+                        catch (InterruptedException e)
+                        {
+                            e.printStackTrace(); // Something happened? Log it?
+                        }
                     }
                 }
             }