It was once widely believed that shroomlights were a parasitic fungus that used Warped and Crimson trees as a host. We now know that shroomlights are actually produced by the tree itself as a way to store energy, not unlike the way plants such as potatoes and carrots grow tubers underground.
Sap collects in pockets just beneath the outermost layer of bark until there is so much sap that it splits through the bark. Once the sap has been exposed to open air, the tree quickly grows a thick “skin” over the split, until the shroomlight is fully formed. Shroomlight skin is thick and leathery, and difficult to break without a tool but it is not uncommon for shroomlights to split open and reseal themselves on their own as sap continues to build up inside.
The sap inside shroomlights is edible, although the taste depends on the biome the tree is from. Warped sap tastes sweet and is often made into a fermented beverage not unlike mead. Crimson sap tastes spicy and is dried and then grated to create a powerful and popular spice. The sap is not particularly rich in nutrients, but it is an incredible energy-booster and one of the only ways to stave off dehydration while in the Nether. The skin of the shroomlight is also edible and an excellent source of fiber, although it is nowhere near as palatable as the sap.