From 5b983b72fa0508fee5135153c9273f5e37fb5467 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Mon, 27 Jan 2014 20:44:18 +0100 Subject: [PATCH] Villager: Farmers can't place crops on blocks other then farmland. --- src/Mobs/Villager.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Mobs/Villager.cpp b/src/Mobs/Villager.cpp index ef362b55..5d6d7482 100644 --- a/src/Mobs/Villager.cpp +++ b/src/Mobs/Villager.cpp @@ -48,7 +48,13 @@ void cVillager::Tick(float a_Dt, cChunk & a_Chunk) { switch (m_Type) { - case vtFarmer: m_World->SetBlock(m_CropsPos.x, m_CropsPos.y, m_CropsPos.z, E_BLOCK_CROPS, 0); + case vtFarmer: + { + if (m_World->GetBlock(m_CropsPos.x, m_CropsPos.y - 1, m_CropsPos.z) == E_BLOCK_FARMLAND) + { + m_World->SetBlock(m_CropsPos.x, m_CropsPos.y, m_CropsPos.z, E_BLOCK_CROPS, 0); + } + } } } return;