Yes, like lIyemu said, you can use the getSpawns method for every biome. You can iterate through them all by using java stream.
You can then to .add and add your entity. Allow me to show you an example:
package <idk, whatever package name you want>;
import <wherever you keep static references to your entities>;
import net.minecraft.entity.EntityClassification;
import net.minecraft.world.biome.Biome.SpawnListEntry;
import net.minecraftforge.registries.ForgeRegistries;
public class ModEntitySpawn {
public static void spawnMobs() {
ForgeRegistries.BIOMES.getValues().stream()
//This is just some randsom filtering but do whatever you want her, or dont filter at all
//if you want your entity to appear anywhere.
.filter(biome -> biome.getRegistryName().toString().equals("minecraft:mushroom_fields")
|| biome.getRegistryName().toString().equals("minecraft:mushroom_fields_field_shore"))
//this is the main dish
.forEach(biome -> {
biome.getSpawns(EntityClassification.<depends on what you want>)
//min and max refer to number of entities in a group.
.add(new SpawnListEntry(<static reference to your entity>, <weight>, <min>, <max>));
});
}
}
Then you have to register it in your event subscriber:
@SubscribeEvent
public static void onLoadSpawns (FMLCommonSetupEvent event) {
ModEntitySpawn.spawnMobs();
}
I hope this is helpful! good luck!