Temporarily disable clientApi neighbor chunk updating

This commit is contained in:
James Seibel
2023-09-09 12:47:23 -05:00
parent 8ae78dbf60
commit e484926f62
@@ -22,7 +22,6 @@ package com.seibel.distanthorizons.core.api.internal;
import com.seibel.distanthorizons.api.methods.events.abstractEvents.*;
import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiRenderParam;
import com.seibel.distanthorizons.core.level.IKeyedClientLevelManager;
import com.seibel.distanthorizons.core.level.IServerKeyedClientLevel;
import com.seibel.distanthorizons.core.pos.DhChunkPos;
import com.seibel.distanthorizons.core.util.objects.Pair;
import com.seibel.distanthorizons.core.world.*;
@@ -236,7 +235,7 @@ public class ClientApi
public void clientChunkLoadEvent(IChunkWrapper chunk, IClientLevelWrapper level) { this.applyChunkUpdate(chunk, level); }
public void clientChunkSaveEvent(IChunkWrapper chunk, IClientLevelWrapper level) { this.applyChunkUpdate(chunk, level); }
private void applyChunkUpdate(IChunkWrapper chunk, IClientLevelWrapper level)
private void applyChunkUpdate(IChunkWrapper chunkWrapper, IClientLevelWrapper level)
{
// if the user is in a single player world the chunk updates are handled on the server side
if (SharedApi.getEnvironment() != EWorldEnvironment.Client_Only)
@@ -250,27 +249,27 @@ public class ClientApi
{
// If the level isn't loaded yet, keep track of which chunks were loaded so we can use them later.
// This may happen if the world and level load events happen out of order
this.waitingChunkByClientLevelAndPos.replace(new Pair<>(level, chunk.getChunkPos()), chunk);
this.waitingChunkByClientLevelAndPos.replace(new Pair<>(level, chunkWrapper.getChunkPos()), chunkWrapper);
return;
}
dhLevel.updateChunkAsync(chunk);
dhLevel.updateChunkAsync(chunkWrapper);
// also update any existing neighbour chunks so lighting changes are propagated correctly
for (int xOffset = -1; xOffset <= 1; xOffset++)
{
for (int zOffset = -1; zOffset <= 1; zOffset++)
{
DhChunkPos neighbourPos = new DhChunkPos(chunk.getChunkPos().x + xOffset, chunk.getChunkPos().z + zOffset);
IChunkWrapper neighbourChunk = dhLevel.getLevelWrapper().tryGetChunk(neighbourPos);
if (neighbourChunk != null)
{
dhLevel.updateChunkAsync(neighbourChunk);
}
}
}
//// also update any existing neighbour chunks so lighting changes are propagated correctly
//for (int xOffset = -1; xOffset <= 1; xOffset++)
//{
// for (int zOffset = -1; zOffset <= 1; zOffset++)
// {
// DhChunkPos neighbourPos = new DhChunkPos(chunkWrapper.getChunkPos().x + xOffset, chunkWrapper.getChunkPos().z + zOffset);
// IChunkWrapper neighbourChunk = dhLevel.getLevelWrapper().tryGetChunk(neighbourPos);
// if (neighbourChunk != null)
// {
// dhLevel.updateChunkAsync(neighbourChunk);
// }
// }
//}
}