How can I prevent Entity Spawn from Spawner block?

sponge 8.0

please help me.

What you will want to do is look at the SpawnType in the EventContextKeys and check if its World_spawner

https://jd.spongepowered.org/spongeapi/8.1.0/org/spongepowered/api/event/cause/entity/SpawnTypes.html#WORLD_SPAWNER

https://jd.spongepowered.org/spongeapi/8.1.0/org/spongepowered/api/event/EventContextKeys.html#SPAWN_TYPE

https://jd.spongepowered.org/spongeapi/8.1.0/org/spongepowered/api/event/Event.html#context()

1 Like

Thank for you care!