diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2021-04-05 02:38:43 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@outlook.com> | 2021-04-12 23:35:07 +0200 |
commit | 4cd49d7eca5f8fd53eb98577a1f218a5086704bb (patch) | |
tree | 09bf29a1d30a37445796ed70867f934435c4261f /src/ClientHandle.cpp | |
parent | Fixed generator for the Mega Taiga biome (#5129) (diff) | |
download | cuberite-4cd49d7eca5f8fd53eb98577a1f218a5086704bb.tar cuberite-4cd49d7eca5f8fd53eb98577a1f218a5086704bb.tar.gz cuberite-4cd49d7eca5f8fd53eb98577a1f218a5086704bb.tar.bz2 cuberite-4cd49d7eca5f8fd53eb98577a1f218a5086704bb.tar.lz cuberite-4cd49d7eca5f8fd53eb98577a1f218a5086704bb.tar.xz cuberite-4cd49d7eca5f8fd53eb98577a1f218a5086704bb.tar.zst cuberite-4cd49d7eca5f8fd53eb98577a1f218a5086704bb.zip |
Diffstat (limited to '')
-rw-r--r-- | src/ClientHandle.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index cd45068ee..f26ed4971 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -538,6 +538,8 @@ void cClientHandle::UnloadOutOfRangeChunks(void) m_Player->GetWorld()->RemoveChunkClient(itr->m_ChunkX, itr->m_ChunkZ, this); SendUnloadChunk(itr->m_ChunkX, itr->m_ChunkZ); } + + m_LastUnloadCheck = m_Player->GetWorld()->GetWorldAge(); } @@ -1981,6 +1983,8 @@ bool cClientHandle::CheckBlockInteractionsRate(void) void cClientHandle::Tick(float a_Dt) { + using namespace std::chrono_literals; + // anticheat fastbreak if (m_HasStartedDigging) { @@ -2069,8 +2073,8 @@ void cClientHandle::Tick(float a_Dt) } } - // Unload all chunks that are out of the view distance (every 5 seconds) - if ((m_Player->GetWorld()->GetWorldAge() % 100) == 0) + // Unload all chunks that are out of the view distance (every 5 seconds): + if ((m_Player->GetWorld()->GetWorldAge() - m_LastUnloadCheck) > 5s) { UnloadOutOfRangeChunks(); } @@ -3012,7 +3016,7 @@ void cClientHandle::SendTitleTimes(int a_FadeInTicks, int a_DisplayTicks, int a_ -void cClientHandle::SendTimeUpdate(Int64 a_WorldAge, Int64 a_WorldDate, bool a_DoDaylightCycle) +void cClientHandle::SendTimeUpdate(const cTickTimeLong a_WorldAge, const cTickTimeLong a_WorldDate, const bool a_DoDaylightCycle) { m_Protocol->SendTimeUpdate(a_WorldAge, a_WorldDate, a_DoDaylightCycle); } |