How I can modify dropped experience from entity and drop after death?
So there isn’t actually a good way to modify both the experience and drops from a single event.
HarvestEntityEvent allows you to control the experience (Though last I checked it wasn’t implemented and is even marked for removal from the API). But to control the drops you would have to listen to
DropItemEvent.Destruct and check to see if it was fired as a result of a player death for example, then filter/modify the spawned items.
I commented about this a while ago on a now long-forgotten issue
The problem there is that they are two distinct events. The items drop the moment the last hit is dealt, but the experience drops when the corpse turns into smoke (and drops from that location, too). That can be a difference of a couple seconds, and depending on the knockback of the hit, multiple blocks of distance.
Hm, I have 2 troubles now:
- HarvestEntityEvent is not called (maybe as said @Zerthick it is still not implemented)…
- DropItemEvent.Destruct.Pre is not called if entity drop nothing. This is logical, but I cant add drop to entity this way…