Why are you casting the entity to an EntityPlayer if it is not an instanceof EntityPlayer
((EntityPlayerMP) entityIn).connection.setPlayerLocation(worldIn.getSpawnPoint().getX(),
worldIn.getSpawnPoint().getY(), worldIn.getSpawnPoint().getZ(), entityIn.getRotationYawHead(),
entityIn.getRotationYawHead());
entityIn.playSound(SoundEvents.ENTITY_ENDERPEARL_THROW, 0.5f, 0.5f);
worldIn.spawnParticle(EnumParticleTypes.PORTAL, entityIn.getPosition().getX(),
entityIn.getPosition().getY(), entityIn.getPosition().getZ(), 0, 0, 10, 0);
}