As the title says, if a pokemon gains a level in a battle, then faints before the battle ends, it will trigger the evolution despite the fact the pokemon is fainted. I have also noticed that, after gaining the level, the pokemon has evolution particles around it during the battle, and the pokemon has the particles and falling over of a dead mob when the evolution screen comes up. I have only tested this with Bulbasaur, but I have tested it with multiple methods of leveling up (swapping it in and out during a trainer battle, exp share).
It's worth noting that I do have a few extra mods (namely, I'm running the Pixelmon Reforged modpack on Technic, with a few mods like JEI and Inventory Tweaks added), but I don't think any of them are causing this.
Steps to reproduce:
•Get a pokemon at a point where a level up would cause it to evolve
•Start a battle with a trainer with multiple pokemon
•Before the last of the trainer's pokemon, make the pokemon in question level up, so it would evolve. You will now see evolution particles on it.
•Before ending the fight, let the pokemon that just leveled up be KOed.
•End the fight. Now you will see the pokemon fall and die, and the evolution screen will come up and be stuck.
I was also told to upload my log, so I will do so here (
https://gist.github.com/DaComputerNerd717/a25221ac8936e0753afb924b7ec22b0e). I had played on a server earlier when I had discovered this, so the testing in singleplayer will be near the end of the log.