Possible workaround you could use:
Listen to the PlayerInteractEvent and check if the player is right clicking a block with the spawn egg in hand. The assumption is that this will always trigger a related CreatureSpawnEvent right afterwards.
So to get the connection from CreatureSpawnEvent to the related PlayerInteractEvent, you could temporary store the information you need from the PlayerInteractEvent in a data structure (like a hashmap), and then get and remove it from there again inside the CreatureSpawnEvent.
The same steps should work for detecting when a creature is spawned because the player right clicked another entity while having a spawn egg in hand.
|