From 9328afe65c72b29f5cedbf1897ea8559f6b2c42f Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Tue, 5 Jan 2021 02:13:02 +0000 Subject: Convert most calls to blocking GetHeight/GetBiomeAt to direct chunk accesses * Hopefully fixes #5094 --- src/Blocks/BlockFarmland.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/Blocks') diff --git a/src/Blocks/BlockFarmland.h b/src/Blocks/BlockFarmland.h index f7003a650..2622ac98c 100644 --- a/src/Blocks/BlockFarmland.h +++ b/src/Blocks/BlockFarmland.h @@ -115,13 +115,14 @@ private: /** Returns true if there's either a water source block close enough to hydrate the specified position, or it's raining there. */ static bool IsWaterInNear(const cChunk & a_Chunk, const Vector3i a_RelPos) { - const auto WorldPos = a_Chunk.RelativeToAbsolute(a_RelPos); - if (a_Chunk.GetWorld()->IsWeatherWetAtXYZ(WorldPos)) + if (a_Chunk.IsWeatherWetAt(a_RelPos.addedY(1))) { // Rain hydrates farmland, too return true; } + const auto WorldPos = a_Chunk.RelativeToAbsolute(a_RelPos); + // Search for water in a close proximity: // Ref.: https://minecraft.gamepedia.com/Farmland#Hydration // TODO: Rewrite this to use the chunk and its neighbors directly -- cgit v1.2.3