pocketmine\entity\Minecart::moveIfRail PHP Method

moveIfRail() private method

Move the minecart as long as it will still be moving on to another piece of rail.
private moveIfRail ( ) : boolean
return boolean True if the minecart moved.
    private function moveIfRail()
    {
        $nextMoveVector = $this->moveVector[$this->direction];
        $nextMoveVector = $nextMoveVector->multiply($this->moveSpeed);
        $newVector = $this->add($nextMoveVector->x, $nextMoveVector->y, $nextMoveVector->z);
        $possibleRail = $this->getCurrentRail();
        if (in_array($possibleRail->getId(), [Block::RAIL, Block::ACTIVATOR_RAIL, Block::DETECTOR_RAIL, Block::POWERED_RAIL])) {
            $this->moveUsingVector($newVector);
            return true;
        }
    }