In a saucepan, heat the half and half until it starts to simmer. Remove the pan from the heat.
In a large heat-proof bowl, whisk together sugar and cornstarch, add egg yolks and whisk until smooth.
Pour the hot half-and-half into the egg yolk mixture in a thin stream, whisking constantly. Keep pouring, whisking constantly, until you’ve added all the hot half-and-half.
Once all of the half and half has been added, pour the entire mixture back into the saucepan and cook over medium heat, whisking constantly, until bubbles rise to the surface and mixture is very thick, about 3–4 minutes. (it should coat the back of a spoon nicely).
Remove pan from heat and add the butter and chopped chocolate to the hot mixture in small handfuls. Mix together until thoroughly incorporated. (it should look like a big pot of hot chocolate pudding)
Stir in the vanilla and whisk to incorporate, then immediately pour the filling through a fine-mesh sieve set over a bowl.
Using a spatula, scrape the strained filling into the baked and cooled crust. Press plastic wrap directly on the surface of the filling and refrigerate the pie until the filling is cold and firm, at least 4 hours or overnight. (This will ensure that no skin will form while it’s cooling).
When ready to serve, whip the heavy cream, sugar, and vanilla together until stiff peaks form.
Spread or pipe the whipped cream over the chilled filling and garnish with shaved chocolate or chocolate chips, if desired. Serve immediately