From 689b2ea8777f198f46e50a96c148f5de2f281614 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Sat, 20 Sep 2014 11:10:46 +0200 Subject: [PATCH] Fixed #2104 Can't place blocks where non-solid entities exist --- src/pocketmine/level/Level.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index 564bd2ac0c..3e1aac3464 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -44,6 +44,7 @@ use pocketmine\block\Sapling; use pocketmine\block\SnowLayer; use pocketmine\block\Sugarcane; use pocketmine\block\Wheat; +use pocketmine\entity\Arrow; use pocketmine\entity\DroppedItem; use pocketmine\entity\Entity; use pocketmine\event\block\BlockBreakEvent; @@ -1133,8 +1134,19 @@ class Level implements ChunkManager, Metadatable{ //$face = -1; } - if($hand->isSolid === true and $hand->getBoundingBox() !== null and count($this->getCollidingEntities($hand->getBoundingBox())) > 0){ - return false; //Entity in block + if($hand->isSolid === true and $hand->getBoundingBox() !== null){ + $entities = $this->getCollidingEntities($hand->getBoundingBox()); + $realCount = 0; + foreach($entities as $e){ + if($e instanceof Arrow or $e instanceof DroppedItem){ + continue; + } + ++$realCount; + } + + if($realCount > 0){ + return false; //Entity in block + } }