mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-25 04:44:03 +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\SnowLayer;
|
||||||
use pocketmine\block\Sugarcane;
|
use pocketmine\block\Sugarcane;
|
||||||
use pocketmine\block\Wheat;
|
use pocketmine\block\Wheat;
|
||||||
|
use pocketmine\entity\Arrow;
|
||||||
use pocketmine\entity\DroppedItem;
|
use pocketmine\entity\DroppedItem;
|
||||||
use pocketmine\entity\Entity;
|
use pocketmine\entity\Entity;
|
||||||
use pocketmine\event\block\BlockBreakEvent;
|
use pocketmine\event\block\BlockBreakEvent;
|
||||||
@ -1133,9 +1134,20 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
//$face = -1;
|
//$face = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($hand->isSolid === true and $hand->getBoundingBox() !== null and count($this->getCollidingEntities($hand->getBoundingBox())) > 0){
|
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
|
return false; //Entity in block
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if($player instanceof Player){
|
if($player instanceof Player){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user