From 4c1773f392a9dc0dbeb0f46573f0860f0b4e4bf9 Mon Sep 17 00:00:00 2001 From: GameHerobrine Date: Fri, 3 Jun 2022 17:07:05 +0300 Subject: [PATCH] farmland disappears after plaer jumped on it =< --- src/world/Entity.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/world/Entity.php b/src/world/Entity.php index b0fd0598..385d4be3 100644 --- a/src/world/Entity.php +++ b/src/world/Entity.php @@ -617,7 +617,11 @@ class Entity extends Position{ if($y < $this->fallY){ $d = $this->level->getBlock(new Vector3($x, $y + 1, $z)); $d2 = $this->level->getBlock(new Vector3($x, $y + 2, $z)); + $blockToFallOn = $this->level->getBlock(new Vector3(floor($x), floor($y), floor($z))); $dmg = ($this->fallY - $y) - 3; + if($blockToFallOn->getID() === FARMLAND){ + $this->level->setBlockRaw($blockToFallOn,new DirtBlock()); + } if($dmg > 0 and !($d instanceof LiquidBlock) and $d->getID() !== LADDER and $d->getID() !== COBWEB and !($d2 instanceof LiquidBlock) and $d2->getID() !== LADDER and $d2->getID() !== COBWEB){ $this->harm($dmg, "fall"); }