Wash pumpkin well with soap and water to remove any pesticides or dirt. Cut the pumpkin in half and remove the seeds and strings. Discard or save for another use, if you'd like. Cut each half into 2-3 inch slices, then cut each slice into 2-3 inch pieces.
Combine the 4 cups water, 1 pound piloncillo, 1 sliced orange, 2 cinnamon sticks, 4 star anise pods, 6 cloves and 6 black peppercorns in a large, 9-quart or larger pot. Bring to a boil over medium heat, stirring occasionally, until piloncillo dissolves.
Add pumpkin pieces and stir as best you can to coat in the syrup. Reduce heat to a gentle simmer and cook uncovered, stirring occasionally, until the pumpkin is fork tender and is heavy with syrup, about 2 hours.
Remove pumpkin pieces with a slotted spoon to a serving tray or bowl and cover with foil to keep warm. Increase heat under the remaining syrup to medium. Continue to cook syrup down until it is reduced and thick enough to coat the back of a spoon, about 20 minutes.
Pour syrup over the pumpkin and serve warm by itself or with a drizzle of cream or ice cream or with milk for breakfast.
Cover any leftovers and refrigerate for up to a week. Rewarm on the stove or in the microwave or serve cold.