From 53987d2d524218c236ec871736d4b3d11f6620c3 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Mon, 28 Sep 2015 08:35:21 -0400 Subject: [PATCH] Fix issue with disappearing chunks on re-render --- TrueCraft.Client/Modules/ChunkModule.cs | 1 - TrueCraft.Client/TrueCraftGame.cs | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/TrueCraft.Client/Modules/ChunkModule.cs b/TrueCraft.Client/Modules/ChunkModule.cs index a406fc8..dc45869 100644 --- a/TrueCraft.Client/Modules/ChunkModule.cs +++ b/TrueCraft.Client/Modules/ChunkModule.cs @@ -105,7 +105,6 @@ namespace TrueCraft.Client.Modules } } if (any) - // In theory this would ready the chunks, but it doesn't work for some reason Game.FlushMainThreadActions(); } diff --git a/TrueCraft.Client/TrueCraftGame.cs b/TrueCraft.Client/TrueCraftGame.cs index d57c89b..98d7097 100644 --- a/TrueCraft.Client/TrueCraftGame.cs +++ b/TrueCraft.Client/TrueCraftGame.cs @@ -250,14 +250,17 @@ namespace TrueCraft.Client public void FlushMainThreadActions() { Action action; - if (PendingMainThreadActions.TryTake(out action)) + while (PendingMainThreadActions.TryTake(out action)) action(); } protected override void Update(GameTime gameTime) { GameTime = gameTime; - FlushMainThreadActions(); + + Action action; + if (PendingMainThreadActions.TryTake(out action)) + action(); IChunk chunk; var adjusted = Client.World.World.FindBlockPosition(