Fix generated sections not appearing

This commit is contained in:
s809
2024-05-10 21:13:40 +05:00
parent 8e1009ab3f
commit 3d86c5c5ee
2 changed files with 16 additions and 5 deletions
@@ -350,12 +350,10 @@ public class DhServerLevel extends AbstractDhLevel implements IDhServerLevel
public void onWorldGenTaskComplete(DhSectionPos pos)
{
IncompleteDataSourceEntry entry = this.incompleteDataSources.get(pos);
if (entry == null)
if (entry != null)
{
return;
this.trySetGeneratedDataSourceToEntry(entry, pos);
}
this.trySetGeneratedDataSourceToEntry(entry, pos);
}
private static class IncompleteDataSourceEntry
@@ -233,7 +233,20 @@ public abstract class AbstractFullDataRequestQueue implements IDebugRenderable,
return entry.future.complete(false);
}
return entry.future.complete(true);
// Hack to work around a race condition
// If you finish the request too quickly, the section will never render
new Thread(() -> {
try
{
Thread.sleep(5000);
entry.future.complete(true);
}
catch (InterruptedException e)
{
throw new RuntimeException(e);
}
}).start();
return null;
});
}