Update IDhApiRenderProxy.clearRenderDataCache() to also clear cached block colors
This commit is contained in:
@@ -258,6 +258,8 @@ public class ClientLevelModule implements Closeable, AbstractDataSourceHandler.I
|
||||
|
||||
public void clearRenderCache()
|
||||
{
|
||||
this.clientLevel.getClientLevelWrapper().clearBlockColorCache();
|
||||
|
||||
ClientRenderState ClientRenderState = this.ClientRenderStateRef.get();
|
||||
if (ClientRenderState != null && ClientRenderState.quadtree != null)
|
||||
{
|
||||
|
||||
@@ -154,10 +154,7 @@ public class DhClientServerLevel extends AbstractDhLevel implements IDhClientLev
|
||||
public IClientLevelWrapper getClientLevelWrapper() { return MC_CLIENT.getWrappedClientLevel(); }
|
||||
|
||||
@Override
|
||||
public void clearRenderCache()
|
||||
{
|
||||
clientside.clearRenderCache();
|
||||
}
|
||||
public void clearRenderCache() { this.clientside.clearRenderCache(); }
|
||||
|
||||
@Override
|
||||
public IServerLevelWrapper getServerLevelWrapper() { return serverLevelWrapper; }
|
||||
|
||||
@@ -151,7 +151,7 @@ public class LodQuadTree extends QuadTree<LodRenderSection> implements IDebugRen
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.error("Quad Tree tick exception for dimension: " + this.level.getClientLevelWrapper().getDimensionType().getDimensionName() + ", exception: " + e.getMessage(), e);
|
||||
LOGGER.error("Quad Tree tick exception for dimension: " + this.level.getLevelWrapper().getDimensionType().getDimensionName() + ", exception: " + e.getMessage(), e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -515,8 +515,12 @@ public class LodQuadTree extends QuadTree<LodRenderSection> implements IDebugRen
|
||||
QuadNode<LodRenderSection> quadNode = nodeIterator.next();
|
||||
if (quadNode.value != null)
|
||||
{
|
||||
quadNode.value.close();
|
||||
quadNode.value = null;
|
||||
if (quadNode.value.renderingEnabled)
|
||||
{
|
||||
quadNode.value.cancelGpuUpload();
|
||||
quadNode.value.uploadRenderDataToGpuAsync();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -306,6 +306,20 @@ public class LodRenderSection implements IDebugRenderable, AutoCloseable
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Note: can cause issues with neighboring LOD sections
|
||||
* if only some (vs all) futures are canceled.
|
||||
*/
|
||||
public void cancelGpuUpload()
|
||||
{
|
||||
CompletableFuture<Void> future = this.uploadRenderDataToGpuFuture;
|
||||
if (future != null)
|
||||
{
|
||||
future.cancel(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//========================//
|
||||
// getters and properties //
|
||||
|
||||
+1
-1
@@ -33,9 +33,9 @@ public interface IClientLevelWrapper extends ILevelWrapper
|
||||
IServerLevelWrapper tryGetServerSideWrapper();
|
||||
|
||||
int getBlockColor(DhBlockPos pos, IBiomeWrapper biome, IBlockStateWrapper blockState);
|
||||
|
||||
/** @return -1 if there was a problem getting the color */
|
||||
int getDirtBlockColor();
|
||||
void clearBlockColorCache();
|
||||
|
||||
/** Will return null if there was an issue finding the biome. */
|
||||
@Nullable
|
||||
|
||||
Reference in New Issue
Block a user