From 732852ddf3507a1eb77a0426f97768a5ada028be Mon Sep 17 00:00:00 2001 From: CobaltXII Date: Thu, 3 Jan 2019 21:36:58 -0500 Subject: [PATCH] Crops can only be placed on farmland --- src/main.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 7c64679..e245d94 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -791,6 +791,19 @@ int main(int argc, char** argv) block_timer = 10; } } + else if (is_crop(place_id)) + { + // Crops can only be placed on farmland. + + block_id crops_below = the_world->get_id_safe(px, py + 1, pz); + + if (crops_below == id_dry_farmland || crops_below == id_wet_farmland) + { + the_accessor->set_id_safe(px, py, pz, place_id); + + block_timer = 10; + } + } else { the_accessor->set_id_safe(px, py, pz, place_id);