public static void RespawnRefreshChunks() { var preloadChunks = Utilities.GetSurroudingChunks(PlayerController.GetCurrentChunkPos(), 1); var unloadChunks = chunkDict.Keys.Except(preloadChunks).ToList(); foreach (Vector2Int chunk in unloadChunks) { NBTHelper.RemoveChunk(chunk.x, chunk.y); } foreach (Vector2Int chunkPos in preloadChunks) { NBTChunk chunk = NBTHelper.LoadChunk(chunkPos.x, chunkPos.y); ChunkRefresher.Add(chunk); } ChunkRefresher.ForceRefreshAll(); }
public static void UnloadChunk(int x, int z) { //Debug.Log("UnloadChunk,x=" + x + ",z=" + z); NBTHelper.RemoveChunk(x, z); }