mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-24 04:14:07 +00:00
Fixed #2104 Can't place blocks where non-solid entities exist
This commit is contained in:
parent
d1f22ee395
commit
689b2ea877
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user