List of usage examples for net.minecraftforge.event.entity.living LivingSpawnEvent.CheckSpawn getEntity
public Entity getEntity()
From source file:vazkii.quark.world.feature.Wraiths.java
License:Creative Commons License
@SubscribeEvent public void onSpawn(LivingSpawnEvent.CheckSpawn event) { if (event.getResult() != Result.ALLOW && event.getEntityLiving() instanceof IMob && event.getWorld() instanceof WorldServer) { List<EntityPlayer> players = ((WorldServer) event.getWorld()).playerEntities; for (EntityPlayer player : players) if (player.getActivePotionEffect(curse) != null && player.getDistanceSq(event.getEntity()) < curseRange * curseRange) { if (!(event.getEntity() instanceof EntityCreeper)) event.getEntityLiving().addPotionEffect( new PotionEffect(MobEffects.FIRE_RESISTANCE, Integer.MAX_VALUE, 0, false, false)); event.setResult(Result.ALLOW); return; }/*from w w w . j a va 2 s . co m*/ } }