protected function checkBlockCollision()
{
$vector = new Vector3(0, 0, 0);
foreach ($blocksaround = $this->getBlocksAround() as $block) {
$block->onEntityCollide($this);
if ($this->getLevel()->getServer()->redstoneEnabled and !$this->isPlayer) {
if ($block instanceof PressurePlate) {
$this->activatedPressurePlates[Level::blockHash($block->x, $block->y, $block->z)] = $block;
}
}
$block->addVelocityToEntity($this, $vector);
}
if ($this->getLevel()->getServer()->redstoneEnabled and !$this->isPlayer) {
/** @var \pocketmine\block\PressurePlate $block * */
foreach ($this->activatedPressurePlates as $key => $block) {
if (!isset($blocksaround[$key])) {
$block->checkActivation();
}
}
}
if ($vector->lengthSquared() > 0) {
$vector = $vector->normalize();
$d = 0.014;
$this->motionX += $vector->x * $d;
$this->motionY += $vector->y * $d;
$this->motionZ += $vector->z * $d;
}
}