In a saucepan, heat up the milk and vanilla seeds, powder, or paste. If using vanilla extract, add it at the end when adding the butter.
Meanwhile, combine egg yolks, sugar, cornstarch, salt, and cacao powder. Mix it all together. It will be pretty thick, but that's ok, once you add the milk, it will be easier to stir.
As soon as the milk comes to a boil, remove from the stove and pour slowly over the egg mixture while whisking at the same time. Keep the bowl sturdy on a wet towel, which prevents the bowl from moving.
Once the eggs are tempered (read the notes above for more info), add the rest of the milk. Transfer back to the stovetop and whisk constantly on medium heat for about 2–5 minutes. It will thicken pretty fast, so don't leave it and walk away!
When the mixture has thickened, take it off the stove and add chocolate pieces if using insted of cacao powder. Mix until melted. Add the vanilla extract if using.
Add the butter. Mix well until creamy and smooth.
Cover with plastic by placing it right at the surface of the cream. This way the cream won't develop skin when cooling.
Transfer to the fridge to chill for at least 4 hours. Use as needed.