Remove unnecessary async render source updates

This commit is contained in:
James Seibel
2024-03-21 20:09:10 -05:00
parent 7726335413
commit 6f7c46e086
3 changed files with 4 additions and 8 deletions
@@ -20,7 +20,6 @@
package com.seibel.distanthorizons.core.file.renderfile;
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
import com.seibel.distanthorizons.core.level.IDhClientLevel;
import com.seibel.distanthorizons.core.pos.DhSectionPos;
import com.seibel.distanthorizons.core.dataObjects.render.ColumnRenderSource;
import com.seibel.distanthorizons.core.sql.repo.RenderDataRepo;
@@ -38,7 +37,7 @@ public interface IRenderSourceProvider extends AutoCloseable
{
CompletableFuture<ColumnRenderSource> getAsync(DhSectionPos pos);
CompletableFuture<Void> updateDataSourceAsync(FullDataSourceV2 dataSource);
void updateDataSource(FullDataSourceV2 dataSource);
/** Deletes any data stored in the render cache so it can be re-created */
void deleteRenderCache();
@@ -112,11 +112,10 @@ public class RenderSourceFileHandler extends AbstractLegacyDataSourceHandler<Col
//=====================//
@Override
public CompletableFuture<Void> updateDataSourceAsync(FullDataSourceV2 inputDataSource)
public void updateDataSource(FullDataSourceV2 inputDataSource)
{
// TODO once the legacy data provider has been replaced this can be removed
this.updateDataSourceAtPos(inputDataSource.getSectionPos(), inputDataSource);
return CompletableFuture.completedFuture(null);
}
@@ -216,10 +216,8 @@ public class ClientLevelModule implements Closeable, AbstractNewDataSourceHandle
ClientRenderState ClientRenderState = this.ClientRenderStateRef.get();
if (ClientRenderState != null)
{
ClientRenderState.renderSourceFileHandler
.updateDataSourceAsync(updatedFullDataSource)
// wait for the update to finish before triggering a reload to prevent holes in the world
.thenRun(() -> ClientRenderState.quadtree.reloadPos(updatedFullDataSource.getSectionPos()));
ClientRenderState.renderSourceFileHandler.updateDataSource(updatedFullDataSource);
ClientRenderState.quadtree.reloadPos(updatedFullDataSource.getSectionPos());
}
}