{"action":"closed","issue":{"url":"https://api.github.com/repos/SpongePowered/SpongeForge/issues/403","labels_url":"https://api.github.com/repos/SpongePowered/SpongeForge/issues/403/labels{/name}","comments_url":"https://api.github.com/repos/SpongePowered/SpongeForge/issues/403/comments","events_url":"https://api.github.com/repos/SpongePowered/SpongeForge/issues/403/events","html_url":"https://github.com/SpongePowered/SpongeForge/issues/403","id":115206105,"number":403,"title":"CastClassException caused by filtering entities - SpawnEntityEvent","user":{"login":"DarkArc","id":778012,"avatar_url":"https://avatars.githubusercontent.com/u/778012?v=3","gravatar_id":"","url":"https://api.github.com/users/DarkArc","html_url":"https://github.com/DarkArc","followers_url":"https://api.github.com/users/DarkArc/followers","following_url":"https://api.github.com/users/DarkArc/following{/other_user}","gists_url":"https://api.github.com/users/DarkArc/gists{/gist_id}","starred_url":"https://api.github.com/users/DarkArc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DarkArc/subscriptions","organizations_url":"https://api.github.com/users/DarkArc/orgs","repos_url":"https://api.github.com/users/DarkArc/repos","events_url":"https://api.github.com/users/DarkArc/events{/privacy}","received_events_url":"https://api.github.com/users/DarkArc/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-05T04:17:57Z","updated_at":"2015-11-05T04:27:17Z","closed_at":"2015-11-05T04:27:17Z","body":"An exception is thrown when trying to filter entities from SpawnEntityEvent (code from my plugin):\r\n````java\r\n    @Listener\r\n    public void onEntitySpawn(SpawnEntityEvent event) {\r\n        // Item Expires shouldn't be filtered anyways, but this is added\r\n        // due to getTargetWorld being unimplemented for the ItemExpireEvent\r\n        // at the time of writing\r\n        if (event instanceof ItemExpireEvent || !isApplicable(event.getTargetWorld())) {\r\n            return;\r\n        }\r\n\r\n        Optional<Zone> manager = event.getCause().first(Zone.class);\r\n        if (manager.isPresent()) {\r\n            return;\r\n        }\r\n\r\n        // Remove every entity that is an agent not spawned by a Zone\r\n        event.filterEntities(e -> !(e instanceof Agent));\r\n    }\r\n````\r\n\r\n````java\r\njava.lang.ClassCastException: net.minecraft.entity.passive.EntityRabbit cannot be cast to org.spongepowered.api.entity.Item\r\n        at net.minecraftforge.event.entity.EntityJoinWorldEvent.filterEntities(EntityJoinWorldEvent.java:90) ~[EntityJoinWorldEvent.class:?]\r\n        at com.skelril.skree.content.world.instance.InstanceWorldWrapper.onEntitySpawn(InstanceWorldWrapper.java:53) ~[InstanceWorldWrapper.class:?]\r\n        at org.spongepowered.common.event.listener.SpawnEntityEventListener_InstanceWorldWrapper_onEntitySpawn18.handle(Unknown Source) ~[?:?]\r\n        at org.spongepowered.common.event.RegisteredListener.handle(RegisteredListener.java:92) ~[RegisteredListener.class:1.8-1530-2.1-DEV-777]\r\n        at org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:218) [SpongeModEventManager.class:1.8-1530-2.1-DEV-777]\r\n        at org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:179) [SpongeModEventManager.class:1.8-1530-2.1-DEV-777]\r\n        at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:67) [EventBus.class:?]\r\n        at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:55) [EventBus.class:?]\r\n        at net.minecraft.world.World.func_175650_b(World.java:3129) [aqu.class:?]\r\n        at net.minecraft.world.chunk.Chunk.func_76631_c(Chunk.java:952) [bfh.class:?]\r\n        at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:46) [ChunkIOProvider.class:?]\r\n        at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:12) [ChunkIOProvider.class:?]\r\n        at net.minecraftforge.common.util.AsynchronousExecutor.skipQueue(AsynchronousExecutor.java:344) [AsynchronousExecutor.class:?]\r\n        at net.minecraftforge.common.util.AsynchronousExecutor.getSkipQueue(AsynchronousExecutor.java:302) [AsynchronousExecutor.class:?]\r\n        at net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(ChunkIOExecutor.java:12) [ChunkIOExecutor.class:?]\r\n        at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:117) [qs.class:?]\r\n        at net.minecraft.world.gen.ChunkProviderServer.func_73158_c(ChunkProviderServer.java:92) [qs.class:?]\r\n        at net.minecraft.world.gen.ChunkProviderServer.func_73154_d(ChunkProviderServer.java:189) [qs.class:?]\r\n        at net.minecraft.world.World.func_72964_e(World.java:304) [aqu.class:?]\r\n        at net.minecraft.world.World.func_175726_f(World.java:299) [aqu.class:?]\r\n        at net.minecraft.world.World.func_180495_p(World.java:837) [aqu.class:?]\r\n        at net.minecraft.block.BlockGrass.func_180650_b(BlockGrass.java:73) [awn.class:?]\r\n        at net.minecraft.block.Block.func_180645_a(Block.java:428) [atr.class:?]\r\n        at net.minecraft.world.WorldServer.onUpdateBlocks(WorldServer.java:117) [qt.class:?]\r\n        at net.minecraft.world.WorldServer.func_147456_g(WorldServer.java:454) [qt.class:?]\r\n        at net.minecraft.world.WorldServer.func_72835_b(WorldServer.java:221) [qt.class:?]\r\n        at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:693) [MinecraftServer.class:?]\r\n        at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:364) [po.class:?]\r\n        at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:598) [MinecraftServer.class:?]\r\n        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:478) [MinecraftServer.class:?]\r\n        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_65]\r\n````"}}