mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-13 16:54:22 +00:00
Fixed issue in ChunkIO that would potentially cause NPEs on chunks. Closes #2837
This commit is contained in:
1 parent
a7d5820e99
commit
d30aae862f
2 files changed
+15
-10
No files matched your search
@@ -47,9 +47,9 @@ public class ChunkIOExecutor
|
||||
{
|
||||
if (!pool.remove(task)) // If it wasn't in the pool, and run hasn't finished, then wait for the async thread.
|
||||
{
|
||||
while (!task.runFinished())
|
||||
synchronized(task)
|
||||
{
|
||||
synchronized(task)
|
||||
while (!task.runFinished())
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -67,7 +67,8 @@ class ChunkIOProvider implements Runnable
|
||||
if (chunk == null)
|
||||
{
|
||||
// If the chunk loading failed just do it synchronously (may generate)
|
||||
provider.originalLoadChunk(this.chunkInfo.x, this.chunkInfo.z);
|
||||
this.chunk = provider.originalLoadChunk(this.chunkInfo.x, this.chunkInfo.z);
|
||||
this.runCallbacks();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -87,13 +88,7 @@ class ChunkIOProvider implements Runnable
|
||||
}
|
||||
|
||||
this.chunk.populateChunk(provider, provider.chunkGenerator);
|
||||
|
||||
for (Runnable r : this.callbacks)
|
||||
{
|
||||
r.run();
|
||||
}
|
||||
|
||||
this.callbacks.clear();
|
||||
this.runCallbacks();
|
||||
}
|
||||
|
||||
public Chunk getChunk()
|
||||
@@ -110,4 +105,14 @@ class ChunkIOProvider implements Runnable
|
||||
{
|
||||
return this.callbacks.size() > 0;
|
||||
}
|
||||
|
||||
public void runCallbacks()
|
||||
{
|
||||
for (Runnable r : this.callbacks)
|
||||
{
|
||||
r.run();
|
||||
}
|
||||
|
||||
this.callbacks.clear();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user