Checking Entities From Spawners

Hello, I’m Zerthick, I’ve been lurking on the forms for a while now and finally got around to porting my plugins over. Anyway, I’m porting over my plugin NoMobFarm that is designed to prevent mob auto-farming from spawners, you can see the old bukkit source here https://github.com/Zerthick/NoMobFarm/blob/master/src/com/gmail/zerthick/nomobfarm/NoMobFarmMain.java However, I’ve hit a snag when trying to keep track of what mobs originated from spawners. Looking through the api the EntitySpawnEvent has no way to ascertain the cause of the event (aka see if the entity came from a spawner block). The EntityAboutToConstructEvent allows you to get a cause however it does not give you access to the entity that will be spawned by the event. So my question is, what is the proper way to go about checking if an entity came from a spawner block?

I guess their is no way atm :frowning:. You could send a PR/(or open an issue) to the SpongeAPI repo.

But until than, idk if is useful. But maybe you could do something with the Spawner itself.

There likely isn’t a cause implemented yet, Make an API/Implementation issue and I’m sure they will add one soon, this is the exact reason why causes were added :slight_smile: