From c0e7708aa7966b42acdaaf1a63cc5662ca848f93 Mon Sep 17 00:00:00 2001 From: peterbell10 Date: Fri, 24 Apr 2020 18:29:12 +0100 Subject: [PATCH] Fix incorrect relative coords usage in farmland handler (#4690) --- src/Blocks/BlockFarmland.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Blocks/BlockFarmland.h b/src/Blocks/BlockFarmland.h index e5a55fcdd..82c4db923 100644 --- a/src/Blocks/BlockFarmland.h +++ b/src/Blocks/BlockFarmland.h @@ -120,7 +120,8 @@ public: /** Returns true if there's either a water source block close enough to hydrate the specified position, or it's raining there. */ bool IsWaterInNear(cChunk & a_Chunk, const Vector3i a_RelPos) { - if (a_Chunk.GetWorld()->IsWeatherWetAtXYZ(a_RelPos)) + const auto WorldPos = a_Chunk.RelativeToAbsolute(a_RelPos); + if (a_Chunk.GetWorld()->IsWeatherWetAtXYZ(WorldPos)) { // Rain hydrates farmland, too return true; @@ -130,7 +131,6 @@ public: // Ref.: https://minecraft.gamepedia.com/Farmland#Hydration // TODO: Rewrite this to use the chunk and its neighbors directly cBlockArea Area; - auto WorldPos = a_Chunk.RelativeToAbsolute(a_RelPos); if (!Area.Read(*a_Chunk.GetWorld(), WorldPos - Vector3i(4, 0, 4), WorldPos + Vector3i(4, 1, 4))) { // Too close to the world edge, cannot check surroundings