Continue improving stabilises of the system

This commit is contained in:
TomTheFurry
2022-09-19 14:54:46 +08:00
parent e330a7cd3b
commit 2257ceae53
4 changed files with 8 additions and 1 deletions
@@ -224,4 +224,9 @@ public class ChunkWrapper implements IChunkWrapper
//if (wrappedLevel != null) return wrappedLevel.getBlockState(new DhBlockPos(x + getMinX(), y, z + getMinZ()));
return BlockStateWrapper.fromBlockState(chunk.getBlockState(new BlockPos(x,y,z)));
}
@Override
public boolean isStillValid() {
return wrappedLevel == null || wrappedLevel.tryGetChunk(chunkPos) == this;
}
}
@@ -127,6 +127,7 @@ public class ClientLevelWrapper implements IClientLevelWrapper
@Override
public IChunkWrapper tryGetChunk(DhChunkPos pos) {
if (!level.hasChunk(pos.x, pos.z)) return null;
ChunkAccess chunk = level.getChunk(pos.getX(), pos.getZ(), ChunkStatus.EMPTY, false);
if (chunk == null) return null;
return new ChunkWrapper(chunk, level, this);
@@ -153,6 +153,7 @@ public class ServerLevelWrapper implements IServerLevelWrapper
}
@Override
public IChunkWrapper tryGetChunk(DhChunkPos pos) {
if (!level.hasChunk(pos.x, pos.z)) return null;
ChunkAccess chunk = level.getChunk(pos.getX(), pos.getZ(), ChunkStatus.EMPTY, false);
if (chunk == null) return null;
return new ChunkWrapper(chunk, level, this);