This is mostly a proof of concept. Basically, every time you deal damage it remembers the name of the mob you did damage to, overwriting the previous value (only relevant if you're damaging multiple mobs at once). When you receive exp for a kill, it then guesses that the last mob you damaged is the one that you killed.
Where it may not work is if you're fighting multiple mobs and something aside from a regular hit kills one, like poison.
This is mostly a proof of concept. Basically, every time you deal damage it remembers the name of the mob you did damage to, overwriting the previous value (only relevant if you're damaging multiple mobs at once). When you receive exp for a kill, it then guesses that the last mob you damaged is the one that you killed.
Where it may not work is if you're fighting multiple mobs and something aside from a regular hit kills one, like poison.