1
0
Fork 0

Fix incorrect relative coords usage in farmland handler (#4690)

This commit is contained in:
peterbell10 2020-04-24 18:29:12 +01:00 committed by GitHub
parent e6cc792cef
commit c0e7708aa7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -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